diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 05:49:29 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 2b04f877c29cf1e95c2fc8154de1da322c7299a3 (patch) | |
| tree | 1430ca4deb53e0fae0b24238af543a13cf2125e1 /src/keys.zig | |
| parent | 779ff8cc27014b8c2f2f078985ab2ca9cf285740 (diff) | |
| download | pardes-2b04f877c29cf1e95c2fc8154de1da322c7299a3.tar.gz pardes-2b04f877c29cf1e95c2fc8154de1da322c7299a3.zip | |
edit: the routing of a text's characters takes the editing context (docs/next-editor.md, R2, first slice): flatSurface, editText, editTextEol, setEditText, setEditTextEnd, setEditTextSpan, paneCursorLines, paneByteAtDisplay, pinPaneCursor, paneWrapWidth, treeIndent, pushUndo, undoStep, stepOwn, selText and vselText take `e: Editor` where they took `*Pardes`, the pane they route to reached through `e.p`; 149 calls in 16 files hand `p.editor()`, nothing else changes; core-test 810 of 949, shell-test 989 of 992, hxdiff 658 / parity 738 / hxgolf 124 with 0 mismatches, replicas pass
Diffstat (limited to 'src/keys.zig')
| -rw-r--r-- | src/keys.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/keys.zig b/src/keys.zig index 413818ed..8a9006dc 100644 --- a/src/keys.zig +++ b/src/keys.zig @@ -381,7 +381,7 @@ pub fn handleKey(p: *Pardes, key: Key) void { if (t.what != .body) { // An explicit selection, else the word under the cursor in the // text as it is shown: a tag's prefix is part of what a word is. - const shown = p.scratch.allocator().dupe(u8, edit.flatSurface(p, t) catch |err| return p.reportError(p.view().active, "exec", err)) catch |err| return p.reportError(p.view().active, "exec", err); + const shown = p.scratch.allocator().dupe(u8, edit.flatSurface(p.editor(), t) catch |err| return p.reportError(p.view().active, "exec", err)) catch |err| return p.reportError(p.view().active, "exec", err); const range = t.primaryRange(shown, 0); const lo = @min(range.anchor, range.head); const hi = @max(range.anchor, range.head); @@ -408,7 +408,7 @@ pub fn handleKey(p: *Pardes, key: Key) void { exec.runBuiltin(p, cmd, p.view().active, "", txt); return; } - edit.pinPaneCursor(p, &pane.body); + edit.pinPaneCursor(p.editor(), &pane.body); const explicit = (if (pane.addon) |k| k.selection.len > 0 else false) or (pane.body.vsel.active and pane.body.vsel.explicit); if (explicit) { @@ -826,7 +826,7 @@ test "s in a header selects in the header's own text" { p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expect(p.view().header != null and pane.prompt == .none); var ranges: [Text.max_selections]modal.Selection = undefined; - const text = try edit.flatSurface(p, &p.global_tag); + const text = try edit.flatSurface(p.editor(), &p.global_tag); const got = p.global_tag.ranges(text, 0, &ranges); try std.testing.expectEqual(@as(usize, 2), got.n); // Newcol, Joincol try std.testing.expectEqual(@as(u16, 0), pane.body.nsel); |
