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/body_layer.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/body_layer.zig')
| -rw-r--r-- | src/body_layer.zig | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/body_layer.zig b/src/body_layer.zig index ab8a888a..ff1f903c 100644 --- a/src/body_layer.zig +++ b/src/body_layer.zig @@ -661,8 +661,10 @@ pub fn paintHeaders(p: *Pardes) !void { cell.style.bg = .{ .rgb = th.sel_bg }; } } + // A prompt answering for the header has the caret on its band. + const asking = if (p.panes[p.active]) |active| active.prompt != .none else false; const cur: usize = @intCast(@max(0, t.cur_row)); - if (cur >= p.header_top and cur < p.header_top + rows) { + if (!asking and cur >= p.header_top and cur < p.header_top + rows) { const bar = modal.lineSlice(text, cur); const caret = panes.File.rawDisplayCol(bar, @min(@as(usize, @intCast(@max(0, t.cur_col))), bar.len)) -| p.header_scroll; if (caret < w) s.cursor = .{ .x = x + @as(u16, @intCast(caret)), .y = y + @as(u16, @intCast(cur - p.header_top)), .bar = t.mode == .insert }; @@ -861,7 +863,8 @@ fn renderHeaderLayer(p: *Pardes, arena: std.mem.Allocator, index: usize, kind: T } } const caret = panes.File.rawDisplayCol(text, @min(@as(usize, @intCast(@max(0, t.cur_col))), text.len)) -| scroll; - if (t.cur_row == line + p.header_top and caret < columns) layer.cursor = .{ .col = @intCast(caret), .bar = t.mode == .insert }; + const asking = if (p.panes[p.active]) |active| active.prompt != .none else false; + if (!asking and t.cur_row == line + p.header_top and caret < columns) layer.cursor = .{ .col = @intCast(caret), .bar = t.mode == .insert }; } else if (p.pointer_inside) { const tag_hit = p.pointer_tag_hit; const col: ?usize = if (tag_hit) |pointer| @@ -920,7 +923,7 @@ pub fn paintPaneTag(p: *Pardes, arena: std.mem.Allocator, pane: *Pane, r: Rect, null else if (pane.prompt == .name) .{ .row = 0, .at = @min(lines[0].len, @as(usize, @intCast(@max(0, pane.input.cur_col)))) } - else if (pane.focus == .tag and pane.tag.cur_row >= top and pane.tag.cur_row < top + rows) caret: { + else if (pane.focus == .tag and pane.prompt == .none and pane.tag.cur_row >= top and pane.tag.cur_row < top + rows) caret: { const row: usize = @intCast(pane.tag.cur_row - top); const lead: usize = if (row + top == 0) prefix_len else 0; break :caret .{ .row = row, .at = @min(lines[row].len, lead + @as(usize, @intCast(@max(0, pane.tag.cur_col)))) }; |
