summaryrefslogtreecommitdiff
path: root/src/edit.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/edit.zig')
-rw-r--r--src/edit.zig10
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;