Repository navigation
Enter an editor send on its own line, reveal the Stata pane on active-terminal sends, and copy unloaded rows whole with the latest copy winning - #425
Merged
Conversation
…e user was typing A send held at --more-- was inserted at the cursor of the user's unfinished input, so typing "di 9" before the prompt returned made Stata run "di 9do file.do" and cleared the input. The console now sets the typed text aside, enters the send alone, and puts the text back. A line the user enters while sends wait still goes at once (typeahead), so it runs first and can answer prompts the console doesn't know.
Routing the active-terminal commands through the pane's queue dropped the terminal.show(true) the sendText path made. The routing now lives in one helper, send_to_active_terminal, which shows the pane (keeping editor focus) before queueing.
…n the Data Browser - A copy whose selection includes rows the grid hasn't loaded reads them from the host first (in the order shown, strLs complete), and fails with a message, clipboard untouched, if they can't be read or the order changes meanwhile. It used to copy them as empty and report success. - Every copy event bumps a sequence; an earlier copy still fetching posts nothing, and Copy Column's late write yields to a later copy. - The selection stays a CompactSelection until copied, and a copy over 1,000,000 cells fails with a message instead of expanding.
Contributor
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 47 minutes. View limit details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A cold review of #416 and #421 found that both introduced bugs in the console and the Data Browser. In the console, a send from the editor could be glued onto whatever the user was typing. In the Data Browser, copying could put incomplete data on the clipboard and report success, a slower copy could overwrite a newer one, and a large row selection was expanded into an index array on every render. This PR fixes the five regressions (part A). The bugs that predate those PRs are in a stacked follow-up (part B).
Fixed
--more--, queuedo file.do, answer the pager, then typedi 9without Enter before the prompt returns. Stata randi 9do file.doand the input line was cleared. The console now sets the typed text aside, enters the send as a line of its own, and puts the text back with its cursor. The direct path had the same bug (a send arriving at a ready prompt while text is typed) and gets the same fix. Ordering is a deliberate choice, documented indocs/send-to-stata.md: a line the user enters while sends wait goes to Stata at once, as typeahead does in console Stata, so it runs before the held sends. Holding it behind them would strand a typed answer to a prompt the console doesn't recognize (display _request()); a test covers that case. Ordering stays deterministic because the PTY is FIFO.send_to_active_terminal. It callsterminal.show(true)before queueing to a pane, so the pane is revealed and the editor keeps focus.requestCopyRowsmessage. Rows are read in the order shown, with strL cells waited for and merged, in runs of at most 50,000 cells per request. If the rows can't be read, or a sort or filter changes the order mid-copy (checked on the host bygenerationand in the webview by an order version), the copy fails visibly and the clipboard is left as it was. The old code missed these rows because it looked for Loading cells, but an unloaded row is shown as an empty Text cell.copyStarted, whether or not the grid has focus. A copy still fetching posts nothing once a later copy has started. Copy Column's late write on the host checks the same rule againstcopy_generation.CompactSelection. A copy's size is checked arithmetically before anything is listed. A copy over 1,000,000 cells is taken over, so Glide doesn't run it either, and fails with a message that points to Copy Column.Proof: each fix has a test that fails on
origin/mainand passes here. Item 3: foursession.test.tscases. Item 14: the show call in the active-terminal pane test. Items 6/8/13:copy-selection.test.ts, which doesn't load on main because the API it tests is new, and two host cases plus a Copy Column case inbrowser-panel.test.ts. Item 3 against real Stata 18 on macOS, driving the console session's editor-send path:On that Mac, the console unit and integration tests and
send-to-stata-integrated-terminal.test.tspassed: 275 pass, 0 fail. These tests use the fake Stata. A livesight consolesession there withset more on,sysuse auto, clearandlist make pricereached--more--. Space paged,qgave--Break--/r(1);, the prompt returned, anddi 6*7printed42. Run separately on this branch:check:line-endings,typecheck,bun test ./tests(10,174 pass, 15 skip, 0 fail),lint,test:ciandpackageall pass. The Data Browser changes are tested at module level and through the host messages. They have not been run by hand in a VS Code webview.Created with Claude Opus 5.5 in Claude Code.