summaryrefslogtreecommitdiff
path: root/src/look.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/look.zig')
-rw-r--r--src/look.zig11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/look.zig b/src/look.zig
index c98e7988..1730a456 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -15,6 +15,7 @@ const std = @import("std");
const builtin = @import("builtin");
const libc = std.c;
const pardes = @import("pardes.zig");
+const lsp = @import("lsp/lsp.zig");
const config = @import("config.zig");
const pdf_enabled = @import("pardes_config").mupdf;
/// The virtual filesystem, on every platform: the browser has only this, and
@@ -776,11 +777,11 @@ pub fn grep(arena: std.mem.Allocator, gpa: std.mem.Allocator, dir: []const u8, b
if (std.mem.indexOfScalar(u8, text[0..@min(len, 1024)], 0) != null) continue; // binary
// per PATH, not per root: one root can straddle the asking pane's
// directory (a shell at `/a` searching for a file pane at `/a/b`), and
- // the rows inside it are the ones worth shortening
- const shown = if (path.len > home.len and std.mem.startsWith(u8, path, home) and path[home.len] == '/')
- path[home.len + 1 ..]
- else
- path;
+ // the rows inside it are the ones worth shortening. The rule is
+ // lsp.rel's — under `base` means relative, anywhere else stays
+ // absolute — and it is THE one spelling now; this used to be an
+ // inline twin that the seam's own comment complained about.
+ const shown = lsp.rel(home, path);
const result = grepText(shown, text, pat, out[written..], find_max_hits - hits);
hits += result.hits;
written += result.bytes;