summaryrefslogtreecommitdiff
path: root/src/keys.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 05:53:16 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commit3dd2072fc525cdadf4f55a69f745c73c0b8c2b21 (patch)
treebbde59afec92eab134c9d8db248ff9369530d952 /src/keys.zig
parent2b04f877c29cf1e95c2fc8154de1da322c7299a3 (diff)
downloadpardes-3dd2072fc525cdadf4f55a69f745c73c0b8c2b21.tar.gz
pardes-3dd2072fc525cdadf4f55a69f745c73c0b8c2b21.zip
edit: the edits of a text take the editing context (docs/next-editor.md, R2, second slice): enterInsert, exitInsert, handleInsert, insertKey, insertEdit, insertTab, pasteRegister, pasteText, normalDelete, normalYank, normalChange, deleteSelection, setEditCells, normalReplaceChar, chordReplace, replaceWithText, normalCase, normalJoin, normalRotateContents, normalAlign, normalIndent, normalToggleComment, normalAdjustNumber, addNewline, textobjectSelect and the three surrounds take `e: Editor`; insertEdit's splice end is `stop` and a comment extension `x` where they were `e`; 71 calls in 8 files hand `p.editor()`; 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.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/keys.zig b/src/keys.zig
index 8a9006dc..03a3b307 100644
--- a/src/keys.zig
+++ b/src/keys.zig
@@ -43,9 +43,9 @@ pub fn cycleMode(p: *Pardes, id: usize) void {
pane.body.mode = .normal;
pane.body.normal.clear();
},
- .normal => edit.enterInsert(p, &pane.body, .at, 1) catch |err| p.reportError(id, "edit", err),
+ .normal => edit.enterInsert(p.editor(), &pane.body, .at, 1) catch |err| p.reportError(id, "edit", err),
.insert => {
- edit.exitInsert(p, &pane.body);
+ edit.exitInsert(p.editor(), &pane.body);
if (pane.isTerminal()) enterTty(p, id);
},
}
@@ -232,7 +232,7 @@ pub fn handleKey(p: *Pardes, key: Key) void {
pane.focus = .body;
}
for ([_]*Text{ &pane.body, &pane.tag }) |t| {
- if (t.mode == .insert) edit.exitInsert(p, t);
+ if (t.mode == .insert) edit.exitInsert(p.editor(), t);
t.normal.clear();
t.select = false;
}
@@ -342,7 +342,7 @@ pub fn handleKey(p: *Pardes, key: Key) void {
p.setMessage(p.view().active, "name drafted: Enter renames the buffer, Esc drops the draft");
return;
}
- edit.handleInsert(p, &pane.input, key);
+ edit.handleInsert(p.editor(), &pane.input, key);
return;
}
if (header == null and pane.prompt != .none) {
@@ -365,7 +365,7 @@ pub fn handleKey(p: *Pardes, key: Key) void {
}
return;
}
- edit.handleInsert(p, &pane.input, key);
+ edit.handleInsert(p.editor(), &pane.input, key);
if (normal.selRegexArmed(pane)) |a| if (panes.promptTarget(p, pane)) |answered| normal.applySelRegex(p, pane, answered, a.pat, a.mode);
return;
}
@@ -444,9 +444,9 @@ pub fn handleKey(p: *Pardes, key: Key) void {
switch (t.mode) {
.normal => normal.handleNormal(p, t, key),
.insert => if (hit(key, config.escape) and !t.reg_wait)
- edit.exitInsert(p, t)
+ edit.exitInsert(p.editor(), t)
else
- edit.handleInsert(p, t, key),
+ edit.handleInsert(p.editor(), t, key),
.tty => forwardKey(p, p.view().active, key),
}
// `.`'s log: the keys of the normal command that entered insert