diff options
Diffstat (limited to 'src/look.zig')
| -rw-r--r-- | src/look.zig | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/look.zig b/src/look.zig index 3da2e044..2e27a001 100644 --- a/src/look.zig +++ b/src/look.zig @@ -8,6 +8,7 @@ const pdf_enabled = @import("pardes_config").mupdf; const fs = @import("fs.zig"); const platform_has_fs = fs.platform_has_fs; const layout = @import("layout.zig"); +const animation = @import("animation.zig"); const modal = @import("modal.zig"); const filesystem = @import("fs.zig"); const panes = @import("panes.zig"); @@ -20,7 +21,7 @@ const pdf = panes.Pdf.pdf; const Pane = panes.Pane; const MAX_PANES = pardes.MAX_PANES; const tag_layer = @import("tag_layer.zig"); -const TagHit = tag_layer.Hit; +const TagHit = pardes.TagHit; const BOX_H = pardes.BOX_H; const TAG_TEXT_INSET = pardes.TAG_TEXT_INSET; const pathUnder = pardes.pathUnder; @@ -1166,6 +1167,13 @@ pub fn lookAt(p: *Pardes, id: usize, operand: []const u8) void { pane.search_row = null; _ = searchStep(p, id, 1); } + // A path that is not there searches for its text, and a search + // that found nothing says so rather than leave an empty buffer. + const results = if (pane.search_pane) |rid| p.panes[rid] else null; + if (results) |r| if (r.file) |f| if (f.content.len == 0) { + var said: [96]u8 = undefined; + p.setMessage(id, std.fmt.bufPrint(&said, "Look: no match for \"{s}\"", .{@import("Messages.zig").clip(trimmed, 48)}) catch "Look: no match"); + }; }, .pane => |t| { if (t.id >= MAX_PANES) return; @@ -1371,13 +1379,13 @@ test "stationary Look hover follows only acknowledged panel samples" { defer p.deinit(); const pane = p.panes[0].?; const rect = p.rects[0]; - const target: layout.Box = .{ + const target: animation.Box = .{ .x = @floatFromInt(rect.x), .y = @floatFromInt(rect.y), .w = @floatFromInt(rect.w), .h = @floatFromInt(rect.h), }; - var track: layout.Track = .{ + var track: animation.Track = .{ .serial = pane.serial, .pane = 0, .phase = .moving, |
