feat: improve find in files performance

This commit is contained in:
CJ van den Berg 2024-07-28 00:13:18 +02:00
parent f535fc02bf
commit 5f22ce81bc
2 changed files with 1 additions and 2 deletions

View file

@ -110,7 +110,6 @@ fn add_find_in_files_result(self: *Self, path: []const u8, begin_line: usize, be
self.find_in_files_done = false; self.find_in_files_done = false;
fl.reset(); fl.reset();
} }
@import("log").logger("mainview").print("match: {s}:{d}:{d}:{d}:{d} {s}", .{ path, begin_line, begin_pos + 1, end_line, end_pos + 1, std.fmt.fmtSliceEscapeLower(lines) });
fl.add_item(.{ fl.add_item(.{
.path = path, .path = path,
.begin_line = begin_line - 1, .begin_line = begin_line - 1,

View file

@ -169,7 +169,7 @@ fn insert_bytes(self: *Self, bytes: []const u8) !void {
var find_cmd_id: ?command.ID = null; var find_cmd_id: ?command.ID = null;
fn flush_input(self: *Self) !void { fn flush_input(self: *Self) !void {
if (self.input.len > 0) { if (self.input.len > 2) {
if (eql(u8, self.input, self.last_input)) if (eql(u8, self.input, self.last_input))
return; return;
@memcpy(self.last_buf[0..self.input.len], self.input); @memcpy(self.last_buf[0..self.input.len], self.input);