fix: remove prefix from paths in ripgrep results

This commit is contained in:
CJ van den Berg 2025-05-28 12:14:18 +02:00
parent 2de25671d6
commit e6e5a2f94e
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -244,7 +244,9 @@ const Process = struct {
.integer => |i| i, .integer => |i| i,
else => return, else => return,
} else return; } else return;
if (path) |p| { if (path) |p_| {
const prefix = "././";
const p = if (p_.len >= prefix.len and std.mem.eql(u8, p_[0..prefix.len], prefix)) p_[prefix.len..] else p_;
const match_text = if (lines) |l| const match_text = if (lines) |l|
if (l[l.len - 1] == '\n') l[0 .. l.len - 1] else l if (l[l.len - 1] == '\n') l[0 .. l.len - 1] else l
else else