diff options
Diffstat (limited to 'core/Prompt.zig')
| -rw-r--r-- | core/Prompt.zig | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/core/Prompt.zig b/core/Prompt.zig index 2f42443b..8081f7f9 100644 --- a/core/Prompt.zig +++ b/core/Prompt.zig @@ -749,11 +749,12 @@ pub fn execWord(p: *Pardes, id: usize) void { /// The span of pane `pane`'s tag its search word takes while its places no /// longer light it (the first Esc cleared them): drawn dimmed (draw.zig). -pub fn unlit(pane: *Pane) ?[2]usize { +pub fn unlit(p: *const Pardes, pane: *Pane) ?[2]usize { const t = &pane.trail; + const whole = Trail.folded(p, pane); for (t.steps[0..t.cur], 0..) |*step, i| if (step.* == .search) { - if (lights(pane, &step.search) or t.cur - i > Trail.shown_steps) return null; - return t.spanOf(i); + if (lights(pane, &step.search) or t.cur - i > whole) return null; + return t.spanOf(i, whole); }; return null; } @@ -1303,7 +1304,7 @@ test "/ searches the body as it is typed: the current place selected, the gutter // n: the word in place, and the line said. typeKeys(p, "n"); try std.testing.expect(std.mem.startsWith(u8, try tagOf(p), "/dirty/ 4/7 › ")); - try std.testing.expect(has(pane.msg[0..pane.msg_len], "/dirty/ 4/7 · line 5")); + try std.testing.expect(has(p.messages.saidBy(pane), "/dirty/ 4/7 · line 5")); typeKeys(p, "nnnn"); try std.testing.expect(std.mem.startsWith(u8, try tagOf(p), "/dirty/ 1/7 ↻ › ")); // Esc: the tints go, the word stays, dimmed; Look on it lights them @@ -1311,10 +1312,10 @@ test "/ searches the body as it is typed: the current place selected, the gutter p.update(.{ .key = .{ .cp = Key.escape } }); try std.testing.expect(!pane.places.started); try std.testing.expect(std.mem.startsWith(u8, try tagOf(p), "/dirty/ 1/7 ↻ › ")); - try std.testing.expect(unlit(pane) != null); + try std.testing.expect(unlit(p, pane) != null); typeKeys(p, "j"); Trail.lookStep(p, 0, 0); - try std.testing.expect(pane.places.started and unlit(pane) == null); + try std.testing.expect(pane.places.started and unlit(p, pane) == null); try std.testing.expectEqual(@as(?usize, 0), pane.places.current); const sel = pane.body.primaryRange(pane.file.?.content, 0); try std.testing.expectEqual(@as(usize, 0), @min(sel.anchor, sel.head)); @@ -1473,7 +1474,7 @@ test "a pipe prompt runs a known filter live, a run a selection: the outputs gho p.update(.{ .pipe_resp = .{ .id = third, .success = true, .outputs = &.{ "\x1e\x1e1", "\x1e\x1e1" } } }); p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expectEqual(TagState.Kind.prompt, p.view().tag_state.kind); - try std.testing.expect(has(pane.msg[0..pane.msg_len], "every run failed")); + try std.testing.expect(has(p.messages.saidBy(pane), "every run failed")); p.update(.{ .key = .{ .cp = Key.escape } }); try std.testing.expectEqualStrings("B\nX\nc\n", pane.file.?.content); try std.testing.expect(p.pipe.preview == null); |
