summaryrefslogtreecommitdiff
path: root/core/Places.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Places.zig')
-rw-r--r--core/Places.zig18
1 files changed, 12 insertions, 6 deletions
diff --git a/core/Places.zig b/core/Places.zig
index 6c3ac9ab..7f847f6a 100644
--- a/core/Places.zig
+++ b/core/Places.zig
@@ -664,8 +664,13 @@ pub fn paint(set: *Places, p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect,
if (!set.shows(pane)) return;
const f = &pane.file.?;
const th = p.theme();
- const strong = p.chromeTheme().search_bg;
- const quiet = colors.mix(th.bg orelse th.tag_bg, strong);
+ var strong = p.chromeTheme().search_bg;
+ var quiet = colors.mix(th.bg orelse th.tag_bg, strong);
+ // A search prompt's pattern that is no regex: its last places, dimmed.
+ if (pardes.Prompt.dims(p, pane)) {
+ strong = quiet;
+ quiet = colors.mix(th.bg orelse th.tag_bg, quiet);
+ }
const hits = set.hits.items;
if (hits.len == 0) return;
const nlines = File.nlines(p.gpa, f);
@@ -728,7 +733,8 @@ pub fn addTicks(set: *Places, p: *Pardes, pane: *Pane, s: *Surface, owner: u8) v
if (!set.shows(pane)) return;
const f = &pane.file.?;
set.buildTicks(p, f);
- const cur = if (set.current) |c| set.tickOf(p, f, c) else null;
+ // (A damaged image's `current` may name no place: none current then.)
+ const cur = if (set.current) |c| (if (c < set.hits.items.len) set.tickOf(p, f, c) else null) else null;
for (set.ticks.items) |b| {
if (s.nrail_ticks == s.rail_ticks.len) return;
s.rail_ticks[s.nrail_ticks] = .{ .owner = owner, .at = b, .current = cur != null and cur.? == b };
@@ -792,11 +798,11 @@ test "places: * finds them all, n and N step them round the end silently, an edi
try std.testing.expectEqual(@as(?usize, 1), set.current);
typeKeys(p, "n");
try std.testing.expectEqual(@as(?usize, 2), set.current);
- const logged = p.messages.len;
typeKeys(p, "n");
try std.testing.expectEqual(@as(?usize, 0), set.current);
- // round the end without a word anywhere
- try std.testing.expectEqual(logged, p.messages.len);
+ // round the end: the search word says so, and the message row echoes
+ // it (Prompt.zig, pick-ui SPEC §7.3)
+ try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(pane), "1/3 ↻ · line 1") != null);
typeKeys(p, "N");
try std.testing.expectEqual(@as(?usize, 2), set.current);