diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 00:35:15 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:17:28 -0300 |
| commit | d5158f6a69ce5a1af6372c140b07379ee0ba2446 (patch) | |
| tree | ec722719840f59263e4b7dbc740681594b526274 /src/terminal.zig | |
| parent | 3b31e0484bd06658f10cd9165b76cb1ca3b198bd (diff) | |
| download | pardes-d5158f6a69ce5a1af6372c140b07379ee0ba2446.tar.gz pardes-d5158f6a69ce5a1af6372c140b07379ee0ba2446.zip | |
Text, edit, normal, look, Query and their readers: the second selection form msel (whole rows r0..r1, for search-result highlights) goes; a visited search result and a query preview's place line are an explicit vsel like any other, back from the line's end (to the result's location start, the line's start for ordinary path:line rows; to the start for a preview line), and every msel branch in the edit ops, the drawing, the terminal's position tracking and the chords goes (visible: the result's highlight covers its line's characters and newline cell instead of the whole row width, with the ordinary selection colours; y, d and c on it act on that range as after x, its newline included, so a yanked result pastes as a line); selections.md and the ; Alt-; X Alt-x rows of helix-keys.md no longer describe msel; Text's walked shape changes (wire semantics)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/terminal.zig')
| -rw-r--r-- | src/terminal.zig | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/terminal.zig b/src/terminal.zig index e8ab7a09..7cb429d9 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -1195,7 +1195,7 @@ pub fn feedOutput(p: *Pardes, pane: *Pane, bytes: []const u8) void { if (pane.terminal == null) return; if (authorityOnly("a terminal's output")) return; const has_positions = pane.ovl != null or pane.body.cur_pinned or pane.body.vsel.active or - pane.body.msel.active or pane.body.nsel > 0 or pane.body.last_edit != null or pane.look_at != null or + pane.body.nsel > 0 or pane.body.last_edit != null or pane.look_at != null or pane.body.ed_undo_len > 0 or pane.body.ed_redo_len > 0 or pointerRowCount(pane) > 0; // A replica's emulator is what the authority's deltas make it; what // pardes keeps over it moves as the authority's ingest told it. @@ -1339,15 +1339,9 @@ fn ingestWithPositions(pane: *Pane, bytes: []const u8) bool { // Where the live pane's own selections sit in `positions`: one whose // row the program erased goes (below), as the edited copy does. const vsel_at: ?usize = if (pane.body.vsel.active) 1 else null; - const msel_at: ?usize = if (pane.body.msel.active) npositions else null; - const sels_at = npositions + @as(usize, if (pane.body.msel.active) 2 else 0); - var extra: [panes.Text.max_selections * 2 + 4]*i32 = undefined; + const sels_at = npositions; + var extra: [panes.Text.max_selections * 2 + 2]*i32 = undefined; var nextra: usize = 0; - if (pane.body.msel.active) { - extra[nextra] = &pane.body.msel.r0; - extra[nextra + 1] = &pane.body.msel.r1; - nextra += 2; - } for (pane.body.sels[0..pane.body.nsel]) |*selection| { extra[nextra] = &selection.row; extra[nextra + 1] = &selection.arow; @@ -1447,7 +1441,6 @@ fn ingestWithPositions(pane: *Pane, bytes: []const u8) bool { erased[i] or (copy_lost and positions[i].edit_row != null) else false; - const msel_lost = if (msel_at) |i| erased[i] or erased[i + 1] else false; var sels_keep: [panes.Text.max_selections]bool = undefined; for (0..pane.body.nsel) |i| sels_keep[i] = !(erased[sels_at + 2 * i] or erased[sels_at + 2 * i + 1]); for ([_][]PositionPin{ positions[0..npositions], pointers }, [_]usize{ at_position, at_pointer }) |batch, first| for (batch, first..) |position, k| { @@ -1474,10 +1467,6 @@ fn ingestWithPositions(pane: *Pane, bytes: []const u8) bool { pane.body.vsel.active = false; moved = true; } - if (msel_lost) { - pane.body.msel.active = false; - moved = true; - } if (pane.body.nsel > 0) { var kept: u16 = 0; for (0..pane.body.nsel) |i| if (sels_keep[i]) { @@ -1774,7 +1763,6 @@ pub fn enterTty(p: *Pardes, id: usize) void { pane.body.mode = .tty; followOutput(pane); // entering raw mode is a request for the live shell - pane.body.msel.active = false; pane.body.vsel.active = false; pane.body.nsel = 0; // The raw renderer follows the live cursor. A captured mouse selection @@ -3445,10 +3433,8 @@ test "a selection whose row ED 3 erased goes; one on the screen stays" { const top: i32 = @intCast(pages.total_rows - pane.rows); const row: i32 = if (in_history) top - 3 else top + 2; pane.body.vsel = .{ .active = true, .row = row, .col = 1 }; - pane.body.msel = .{ .active = true, .r0 = row, .r1 = row }; p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[3J" } }); try std.testing.expectEqual(!in_history, pane.body.vsel.active); - try std.testing.expectEqual(!in_history, pane.body.msel.active); if (!in_history) try std.testing.expectEqual(@as(i32, 2), pane.body.vsel.row); } } |
