Repository navigation
Send whole lines again under #delimit ; so Send Statement never skips or repeats code, and send input from a data line as its whole block - #424
Merged
Conversation
… or repeats code, and send input from a data line as its whole block #420 cut #delimit ; lines at statement boundaries by character. That skipped a one-line if/else chain sharing lines with other statements, sent a command twice when a block comment after its ; ended on the next line (and cut the comment in Send Upward Lines), sent a lone input data row, and took seconds on a large block because widening searched every statement for each block edge. Sends take whole lines again, as before #420, with one cut: a line that ends a statement begun above it and then holds whole statements of its own (display / 1; clear;). A send from above ends at that statement's ; and leaves the cursor on the line; Send Statement there sends the rest. A * comment whose ; is on a later line counts as such a statement. Anything else, such as a closer, a header, or a comment ending on the line, keeps the line whole. Fixed in the whole-line code too: a block's closer line that continues onto the next line (}; di ///) now takes that line, and a line holding one block's closer and another's header takes both blocks. Every line of input through its end now sends the whole block. A property test steps through generated #delimit ; and cr documents and checks that the sends, lexed one by one, add up to the document's tokens: each statement once, in order, no comment or string cut. Co-authored-by: Claude Opus 5.5 <[email protected]>
…starts above it With // note on one line and di 1; di 2; on the next, Send Statement on the second line sent only di 2;, since the statement di 1; counted as begun at its comment. A cut now needs the statement's code to start on an earlier line. The step-through property also generates a comment line before a statement and a cr program whose body switches to #delimit ;. Co-authored-by: Claude Opus 5.5 <[email protected]>
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 33 minutes. View limit details
|
jbearak
added a commit
that referenced
this pull request
Nov 19, 2026
…at ignored holds, and di/pr as random command names (#427) * Make the app temp-file test's mock honor holds, so test order can't delete a held file Bun keeps a module mock for later test files. This file's mock of temp-file.ts had no hold_temp_file/release_temp_file and deleted unconditionally, so when it ran before temp-file.test.ts (or without the integrated-terminal test loading first) the held-file test failed with ENOENT, as it did in CI on #424. * Keep di, pr and other specially parsed names out of the varlist property test's command names A random two-letter name is sometimes di (display's arguments are not a varlist) or pr (a program definition), which failed CI on this PR with counterexamples ["di","_",1] and ["_","pr","a",1]. The parser reads both the same way at 6d98b9b, so the test was already flaky.
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.
#420 made Send Statement under
#delimit ;cut lines at statement boundaries, character by character. That broke cases that worked before it. Stepping through a file with repeated Send Statement could skip anif/elsechain or run a command twice. It could also cut a comment in half or send a loneinputdata row, and a large block took seconds to send.Design: whole lines again, with one cut. Making character-level cutting correct for every shape (one-line
if/else, closers, comments ending mid-line,inputdata, cr regions switching to#delimit ;) kept needing special cases. So sends take whole lines again, as at 6d98b9b before #420. The one exception is the case #420 was written for, and only where it's safe: a line that ends a statement whose code began on an earlier line and then holds only complete statements of its own (display/1; clear;). A send from above ends at that statement's;and leaves the cursor on the line. Send Statement there sends the rest. If the line is joined to the next one, has a block header or closer after the cut, holds a#delimit, or opens with the end of a comment, it is sent whole. One function decides the cut for both sends, so the two halves always add up to the whole line. Send Upward Lines ends at the same cut, and Send Downward Lines starts after it unless that falls inside a block's body. #420's per-version reading cache and its release-workflow change are untouched.Fixed (review items; text sent,
#delimit ;line omitted):di 1; if 1 di 2;/else di 3; di 4;, steppingdi 1;→di 4;replace x = x + 1; /* note/continued */, steppingreplace…; /* note→replace…; /* note\ncontinued */→di 2;replace…; /* note\ncontinued */→di 2;replace…; /* note(comment cut)input x;/1;/2;/end;, cursor on2;1;\n2;(cr mode:1\n2)input x;…end;in both modesquietly {;around 12,000ifblocks, cached send* comment/ends; erase important.dta;, stepping* comment\nends; erase important.dta;* comment\nends;→erase important.dta;Also fixed, found by the new property test. These bugs are in the whole-line code and were already there at 6d98b9b:
}; di ////m1;) sent half ofdi. Widening to a block now follows joined lines in both directions, and still looks at each line once.ifheader (di 1; }; if 1 di 2;/else di 3;) sent theifwithout itselse. Lines now record the extent of every block on them, not just one.// note/di 1; di 2;with the cursor on the second line sent onlydi 2;(main too).Not fixed (item 4; the design keeps these whole-line, as before #420):
erase sensitive.dta;foreach x in a {;…};: Send Statement from the closer still sends theerase.program define pwith a#delimit ;body closed byend; clear;: sending the header still sendsclear;.#420 behavior deliberately reverted to whole lines: on
}; clear;, Send Statement sends the block withclear;. Onclear; display/1;, either line sends both statements. Code before a header on its line, and a cursor on a middle line, send from the statement's first line.Proof: the new regression and step-through property tests fail on origin/main and pass here. The property test steps through generated
#delimit ;, cr, and mixed documents. It checks that the sends, each lexed on its own, add up to the document's tokens: every statement once and in order, with no comment or string cut. The cut path is exercised: about 3.5% of generated sends are cuts. On 466fdc4,check:line-endings,typecheck,bun test ./tests(10,151 pass, 0 fail),lint,test:ci, andpackageall pass, run separately.Created with Claude Opus 5.5 in Claude Code.