fix: logging of file matches
This commit is contained in:
parent
a65794f673
commit
36a24d84e3
2 changed files with 3 additions and 8 deletions
|
@ -80,6 +80,7 @@ const Process = struct {
|
|||
tag: [:0]const u8,
|
||||
logger: log.Logger,
|
||||
stdin_behavior: std.process.Child.StdIo,
|
||||
match_count: usize = 0,
|
||||
|
||||
const Receiver = tp.Receiver(*Process);
|
||||
|
||||
|
@ -150,7 +151,6 @@ const Process = struct {
|
|||
|
||||
fn handle_output(self: *Process, bytes: []u8) !void {
|
||||
try self.output.appendSlice(bytes);
|
||||
// self.logger.print("{s}", .{bytes}) catch {};
|
||||
}
|
||||
|
||||
fn handle_terminated(self: *Process) !void {
|
||||
|
@ -161,11 +161,9 @@ const Process = struct {
|
|||
var msg_buf: [tp.max_message_size]u8 = undefined;
|
||||
const msg: tp.message = .{ .buf = try cbor.fromJson(json, &msg_buf) };
|
||||
try self.dispatch(msg);
|
||||
// var buf: [tp.max_message_size]u8 = undefined;
|
||||
// self.logger.print("json: {s}", .{try msg.to_json(&buf)}) catch {};
|
||||
}
|
||||
// self.logger.print("done", .{}) catch {};
|
||||
try self.parent.send(.{ self.tag, "done" });
|
||||
self.logger.print("found {d} matches", .{self.match_count});
|
||||
}
|
||||
|
||||
fn dispatch(self: *Process, m: tp.message) !void {
|
||||
|
@ -232,5 +230,6 @@ const Process = struct {
|
|||
} else {
|
||||
try self.parent.send(.{ self.tag, line, begin, line, end });
|
||||
}
|
||||
self.match_count += 1;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -37,7 +37,6 @@ panels: ?*WidgetList = null,
|
|||
last_match_text: ?[]const u8 = null,
|
||||
location_history: location_history,
|
||||
file_stack: std.ArrayList([]const u8),
|
||||
find_in_files_count: usize = 0,
|
||||
find_in_files_done: bool = false,
|
||||
panel_height: ?usize = null,
|
||||
|
||||
|
@ -94,12 +93,9 @@ pub fn receive(self: *Self, from_: tp.pid_ref, m: tp.message) error{Exit}!bool {
|
|||
var end_pos: usize = undefined;
|
||||
var lines: []const u8 = undefined;
|
||||
if (try m.match(.{ "FIF", tp.extract(&path), tp.extract(&begin_line), tp.extract(&begin_pos), tp.extract(&end_line), tp.extract(&end_pos), tp.extract(&lines) })) {
|
||||
self.find_in_files_count += 1;
|
||||
try self.add_find_in_files_result(path, begin_line, begin_pos, end_line, end_pos, lines);
|
||||
return true;
|
||||
} else if (try m.match(.{ "FIF", "done" })) {
|
||||
log.logger("find").print("found {d} matches", .{self.find_in_files_count});
|
||||
self.find_in_files_count = 0;
|
||||
self.find_in_files_done = true;
|
||||
return true;
|
||||
} else if (try m.match(.{"write_restore_info"})) {
|
||||
|
|
Loading…
Add table
Reference in a new issue