diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 09:05:35 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 0d04bc9214cccce42d74862b31376d49bdda3956 (patch) | |
| tree | b45286fe0847b08c76e6abd562f6e2f985322e17 /src/edit.zig | |
| parent | 66c0106691e4de925011f314200e85ee265b7861 (diff) | |
| download | pardes-0d04bc9214cccce42d74862b31376d49bdda3956.tar.gz pardes-0d04bc9214cccce42d74862b31376d49bdda3956.zip | |
Let s, S and | pressed in a tag answer for the tag's own text
A tag is a text like the body, so selecting on a regex and piping act on the
text they are pressed in: a prompt records the text it answers for, the tag
keeps the keyboard while it is typed, and a header's prompt goes on the active
pane's band. `/` still searches the body from anywhere, as acme's Look from a
tag searches the body.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/edit.zig')
| -rw-r--r-- | src/edit.zig | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/edit.zig b/src/edit.zig index 837a22c6..e21352e1 100644 --- a/src/edit.zig +++ b/src/edit.zig @@ -74,10 +74,12 @@ pub fn typeToTty(p: *Pardes, id: usize, pane: *const Pane, text: []const u8) voi } pub fn applyPaste(p: *Pardes, bytes: []const u8) void { - if (tagline.focusedHeader(p)) |t| { + // A prompt answering for a header takes the paste, as it takes keys. + const asking = if (p.panes[p.active]) |active| active.prompt != .none else false; + if (!asking) if (tagline.focusedHeader(p)) |t| { p.clip_pending = null; return pasteInto(p, t, bytes); - } + }; const req = p.clip_pending; p.clip_pending = null; if (bytes.len == 0) return; @@ -94,7 +96,7 @@ pub fn applyPaste(p: *Pardes, bytes: []const u8) void { n += 1; }; if (n > 0) insertKey(p, &pane.input, .{ .cp = line[0], .text = line[0..n] }); - if (normal.selRegexArmed(pane)) |a| normal.applySelRegex(p, pane, a.pat, a.split); + if (normal.selRegexArmed(pane)) |a| if (p.promptTarget(pane)) |t| normal.applySelRegex(p, pane, t, a.pat, a.split); return; } if (pane.focus == .tag) return pasteInto(p, &pane.tag, bytes); @@ -400,7 +402,7 @@ fn editTextEol(p: *Pardes, t: *Text, b: Bounds) ?panes.EditText { } /// install a rewritten editable text (frees the old one) -fn setEditText(p: *Pardes, t: *Text, new: []u8) void { +pub fn setEditText(p: *Pardes, t: *Text, new: []u8) void { if (t.what != .body) { if (t.own) |old| p.gpa.free(old); t.own = new; |
