diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 00:05:42 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:16:28 -0300 |
| commit | 8d647e9c9fc747c14a222a53f9e3db1ba7a07d01 (patch) | |
| tree | 9f935408a95fab551b5882c834fbf19352fdbc67 /src/edit.zig | |
| parent | a92951b11ab3aa2cdf759b3b743f8af006c21b95 (diff) | |
| download | pardes-8d647e9c9fc747c14a222a53f9e3db1ba7a07d01.tar.gz pardes-8d647e9c9fc747c14a222a53f9e3db1ba7a07d01.zip | |
pardes, normal, edit: multi_on goes: outside a replay the replay state means one range, its first pass (index 0, count 1, first true), so setYank, registerValue, pushUndo and the open-lines and Tab checks read it plainly; Pardes's walked shape changes, so a client and a daemon from either side refuse each other (wire semantics)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/edit.zig')
| -rw-r--r-- | src/edit.zig | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/edit.zig b/src/edit.zig index 5d46b80d..33b0f050 100644 --- a/src/edit.zig +++ b/src/edit.zig @@ -41,16 +41,15 @@ pub fn setYank(p: *Pardes, text: []const u8) void { '*' => name = '+', else => {}, } - const one = !p.multi_on; - p.registers.put(p.gpa, name, text, if (one) 0 else p.multi_index, if (one) 1 else p.multi_count, one or p.multi_first); - if (name == '+' and (one or p.multi_first)) p.emit(.{ .set_clipboard = {} }); + p.registers.put(p.gpa, name, text, p.multi_index, p.multi_count, p.multi_first); + if (name == '+' and p.multi_first) p.emit(.{ .set_clipboard = {} }); } /// Value `i` of register `name` as the command at range `i` reads it, the /// computed registers included: `#` is the range's number from 1, `.` its /// text, `%` the file's name, `_` nothing. Scratch- or register-owned. pub fn registerValue(p: *Pardes, t: *Text, name: u21) ?[]const u8 { - const i = if (p.multi_on) p.multi_index else 0; + const i = p.multi_index; return switch (name) { '_' => null, '#' => std.fmt.allocPrint(p.scratch.allocator(), "{d}", .{i + 1}) catch null, @@ -671,7 +670,7 @@ pub fn enterInsert(p: *Pardes, t: *Text, where: InsertAt, cnt: usize) void { t.cur_row = @as(i32, @intCast(if (below) row + 1 else row)) + eb.row0; t.cur_col = @intCast(ind.len); t.cur_pinned = true; - if (cnt > 1 and !p.multi_on) opened: { + if (cnt > 1 and p.multi_count == 1) opened: { const t2 = flatSurface(p, t) catch break :opened; var rs: [Text.max_selections]modal.Selection = undefined; const m = @min(cnt, Text.max_selections); @@ -1006,7 +1005,7 @@ fn insertEdit(p: *Pardes, t: *Text, key: Key) void { }, Key.tab => { const ln = modal.lineSlice(text, c.row); - if (!p.multi_on and c.col > 0 and c.col <= ln.len and ln[c.col - 1] == '.') dot: { + if (p.multi_count == 1 and c.col > 0 and c.col <= ln.len and ln[c.col - 1] == '.') dot: { if (t.what != .body) break :dot; const f = (t.pane() orelse break :dot).file orelse break :dot; if (f.output != null or !lsp.speaks(f.path)) break :dot; @@ -1985,7 +1984,7 @@ pub fn surroundReplace(p: *Pardes, t: *Text, from: u21, to: u21) void { pub fn pushUndo(p: *Pardes, t: *Text) void { // one keystroke, one undo step — even when it edited at ten cursors. - if (p.multi_on and !p.multi_first) return; + if (!p.multi_first) return; switch (t.what) { // A B1 chord took its one undo point when it began (mouse.zig). .body => if (p.chord_hold) return, |
