fix: prevent find_in_file from removing the last char of a match string

This commit is contained in:
CJ van den Berg 2024-12-13 21:55:53 +01:00
parent fd648b7b07
commit c83d9387ef
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -236,7 +236,7 @@ const Process = struct {
} else return; } else return;
if (path) |p| { if (path) |p| {
const match_text = if (lines) |l| const match_text = if (lines) |l|
if (l[l.len - 1] == '\n') l[0 .. l.len - 2] else l if (l[l.len - 1] == '\n') l[0 .. l.len - 1] else l
else else
""; "";
try self.parent.send(.{ self.tag, p, line, begin, line, end, match_text }); try self.parent.send(.{ self.tag, p, line, begin, line, end, match_text });