Compare commits
No commits in common. "47aefb6f2445392e5816691287c0366f6888c1b9" and "8355f14f62a1cf19710bb00ffbb2981e455395ca" have entirely different histories.
47aefb6f24
...
8355f14f62
3 changed files with 5 additions and 23 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue