summaryrefslogtreecommitdiff
path: root/core/Prompt.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Prompt.zig')
-rw-r--r--core/Prompt.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/Prompt.zig b/core/Prompt.zig
index 3dc13e1f..83432cae 100644
--- a/core/Prompt.zig
+++ b/core/Prompt.zig
@@ -1170,6 +1170,10 @@ pub fn steps(p: *Pardes, arena: std.mem.Allocator, out: *[Band.max_steps]Band.St
return out[0 .. made + try historyStep(p, arena, &out[made])];
}
+/// A history step's row's index: its line's place in the ring with this
+/// bit, which a click tells from the other steps' rows (Command.point).
+pub const history_row: u16 = 0x8000;
+
/// The history step (Ctrl-r): its lines newest first, those holding the
/// field, the one Up recalled on.
fn historyStep(p: *Pardes, arena: std.mem.Allocator, out: *Band.Step) !usize {
@@ -1181,7 +1185,7 @@ fn historyStep(p: *Pardes, arena: std.mem.Allocator, out: *Band.Step) !usize {
while (back <= r.n and rows.items.len < Band.Cursor.shown) : (back += 1) {
const l = r.get(back).?;
if (std.mem.indexOf(u8, l, q) == null) continue;
- try rows.append(arena, .{ .text = l, .on = back == s.prompt.recall, .index = back });
+ try rows.append(arena, .{ .text = l, .on = back == s.prompt.recall, .index = history_row | back });
}
if (rows.items.len == 0) try rows.append(arena, .{ .text = if (r.n == 0) "no history yet" else "no line holds it", .dim = true });
out.* = .{ .rows = rows.items };