diff --git a/src/ripgrep.zig b/src/ripgrep.zig index c99b625..219c4d4 100644 --- a/src/ripgrep.zig +++ b/src/ripgrep.zig @@ -2,7 +2,8 @@ const std = @import("std"); const tp = @import("thespian"); const cbor = @import("cbor"); const log = @import("log"); -const bin_path = @import("bin_path"); + +pub const ripgrep_binary = "rg"; pid: ?tp.pid, stdin_behavior: std.process.Child.StdIo, @@ -120,7 +121,7 @@ const Process = struct { errdefer self.deinit(); _ = tp.set_trap(true); const args = tp.message.fmt(.{ - get_ripgrep(), + ripgrep_binary, // "--line-buffered", "--fixed-strings", "--json", @@ -181,9 +182,9 @@ const Process = struct { } else if (try m.match(.{ tp.any, tp.any, "exited", 1 })) { self.logger.print("no matches found", .{}); } else if (try m.match(.{ tp.any, tp.any, "error.FileNotFound", 1 })) { - self.logger.print_err(get_ripgrep(), "'{s}' executable not found", .{get_ripgrep()}); + self.logger.print_err(ripgrep_binary, "'{s}' executable not found", .{ripgrep_binary}); } else if (try m.match(.{ tp.any, tp.any, tp.extract(&err_msg), tp.extract(&exit_code) })) { - self.logger.print_err(get_ripgrep(), "terminated {s} exitcode: {d}", .{ err_msg, exit_code }); + self.logger.print_err(ripgrep_binary, "terminated {s} exitcode: {d}", .{ err_msg, exit_code }); } } } @@ -255,18 +256,3 @@ const Process = struct { self.match_count += 1; } }; - -const rg_binary = "rg"; -const default_rg_binary = "/bin/" ++ rg_binary; - -var rg_path: ?struct { - path: ?[:0]const u8 = null, -} = null; - -pub fn get_ripgrep() []const u8 { - const allocator = std.heap.c_allocator; - if (rg_path) |p| return p.path orelse default_rg_binary; - const path = bin_path.find_binary_in_path(allocator, rg_binary) catch default_rg_binary; - rg_path = .{ .path = path }; - return path orelse default_rg_binary; -} diff --git a/src/tui/mode/overlay/palette.zig b/src/tui/mode/overlay/palette.zig index fd981cd..094d164 100644 --- a/src/tui/mode/overlay/palette.zig +++ b/src/tui/mode/overlay/palette.zig @@ -213,7 +213,6 @@ pub fn Create(options: type) type { self.items = 0; self.menu.reset_items(); self.menu.selected = null; - self.longest = self.inputbox.text.items.len; for (self.entries.items) |entry| self.longest = @max(self.longest, entry.label.len); diff --git a/src/tui/status/branch.zig b/src/tui/status/branch.zig index 706c7b5..d11b9ab 100644 --- a/src/tui/status/branch.zig +++ b/src/tui/status/branch.zig @@ -93,12 +93,9 @@ fn process_git(self: *Self, m: tp.message) MessageFilter.Error!bool { } fn process_status(self: *Self, m: tp.message) MessageFilter.Error!bool { - defer Widget.need_render(); - var value: []const u8 = undefined; var ahead: []const u8 = undefined; var behind: []const u8 = undefined; - if (self.done) { self.done = false; self.changed = 0;