Compare commits
5 commits
47aefb6f24
...
36e6d6a69f
Author | SHA1 | Date | |
---|---|---|---|
36e6d6a69f | |||
b3c5f4cbb9 | |||
09be9b3774 | |||
df70384b7b | |||
ce2c370cfd |
6 changed files with 35 additions and 1 deletions
|
@ -440,6 +440,7 @@ pub fn build_exe(
|
|||
.{ .name = "thespian", .module = thespian_mod },
|
||||
.{ .name = "cbor", .module = cbor_mod },
|
||||
.{ .name = "log", .module = log_mod },
|
||||
.{ .name = "bin_path", .module = bin_path_mod },
|
||||
},
|
||||
});
|
||||
|
||||
|
|
13
contrib/test_race.sh
Executable file
13
contrib/test_race.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ "$1" == "--build" ]; then
|
||||
shift
|
||||
echo "building..."
|
||||
zig build -freference-trace --prominent-compile-errors
|
||||
fi
|
||||
|
||||
for i in {1..60}; do
|
||||
echo "running $i ..."
|
||||
flow --exec quit "$@" || exit 1
|
||||
done
|
|
@ -157,6 +157,7 @@
|
|||
["f9", "theme_prev"],
|
||||
["f10", "theme_next"],
|
||||
["f11", "toggle_panel"],
|
||||
["shift+f11", "toggle_highlight_columns"],
|
||||
["ctrl+f11", "toggle_inspector_view"],
|
||||
["f12", "goto_definition"],
|
||||
["f34", "toggle_whitespace_mode"],
|
||||
|
|
|
@ -95,13 +95,16 @@ pub fn deinit(self: *Self) void {
|
|||
self.event_buffer.deinit();
|
||||
}
|
||||
|
||||
var in_panic: std.atomic.Value(bool) = .init(false);
|
||||
var panic_cleanup: ?struct {
|
||||
allocator: std.mem.Allocator,
|
||||
tty: *vaxis.Tty,
|
||||
vx: *vaxis.Vaxis,
|
||||
} = null;
|
||||
|
||||
pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, ret_addr: ?usize) noreturn {
|
||||
_ = error_return_trace; // TODO: what to do with this in zig-0.14?
|
||||
in_panic.store(true, .release);
|
||||
const cleanup = panic_cleanup;
|
||||
panic_cleanup = null;
|
||||
if (cleanup) |self| {
|
||||
|
@ -111,6 +114,10 @@ pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, ret_
|
|||
return std.debug.defaultPanic(msg, ret_addr orelse @returnAddress());
|
||||
}
|
||||
|
||||
pub fn panic_in_progress() bool {
|
||||
return in_panic.load(.acquire);
|
||||
}
|
||||
|
||||
pub fn run(self: *Self) Error!void {
|
||||
self.vx.sgr = .legacy;
|
||||
self.vx.conpty_hacks = true;
|
||||
|
@ -130,6 +137,7 @@ pub fn run(self: *Self) Error!void {
|
|||
}
|
||||
|
||||
pub fn render(self: *Self) !void {
|
||||
if (in_panic.load(.acquire)) return;
|
||||
var bufferedWriter = self.tty.bufferedWriter();
|
||||
try self.vx.render(bufferedWriter.writer().any());
|
||||
try bufferedWriter.flush();
|
||||
|
|
|
@ -126,6 +126,7 @@ const Process = struct {
|
|||
"--json",
|
||||
"--smart-case",
|
||||
self.query,
|
||||
"./.", // never search stdin
|
||||
});
|
||||
self.sp = tp.subprocess.init(self.allocator, args, module_name, self.stdin_behavior) catch |e| return tp.exit_error(e, @errorReturnTrace());
|
||||
tp.receive(&self.receiver);
|
||||
|
|
|
@ -24,6 +24,7 @@ allocator: Allocator,
|
|||
rdr_: renderer,
|
||||
config_: @import("config"),
|
||||
highlight_columns_: []u16,
|
||||
highlight_columns_configured: []u16,
|
||||
frame_time: usize, // in microseconds
|
||||
frame_clock: tp.metronome,
|
||||
frame_clock_running: bool = false,
|
||||
|
@ -130,12 +131,14 @@ fn init(allocator: Allocator) InitError!*Self {
|
|||
idx += 1;
|
||||
break :blk idx;
|
||||
};
|
||||
const highlight_columns__ = try allocator.alloc(u16, hl_cols);
|
||||
|
||||
var self = try allocator.create(Self);
|
||||
self.* = .{
|
||||
.allocator = allocator,
|
||||
.config_ = conf,
|
||||
.highlight_columns_ = try allocator.alloc(u16, hl_cols),
|
||||
.highlight_columns_ = highlight_columns__,
|
||||
.highlight_columns_configured = highlight_columns__,
|
||||
.rdr_ = try renderer.init(allocator, self, tp.env.get().is("no-alternate"), dispatch_initialized),
|
||||
.frame_time = frame_time,
|
||||
.frame_clock = frame_clock,
|
||||
|
@ -221,6 +224,7 @@ fn init_delayed(self: *Self) command.Result {
|
|||
}
|
||||
|
||||
fn deinit(self: *Self) void {
|
||||
self.allocator.free(self.highlight_columns_configured);
|
||||
if (self.mouse_idle_timer) |*t| {
|
||||
t.cancel() catch {};
|
||||
t.deinit();
|
||||
|
@ -788,6 +792,12 @@ const cmds = struct {
|
|||
}
|
||||
pub const toggle_whitespace_mode_meta: Meta = .{ .description = "Next whitespace mode" };
|
||||
|
||||
pub fn toggle_highlight_columns(self: *Self, _: Ctx) Result {
|
||||
defer self.logger.print("highlight columns {s}", .{if (self.highlight_columns_.len > 0) "enabled" else "disabled"});
|
||||
self.highlight_columns_ = if (self.highlight_columns_.len > 0) &.{} else self.highlight_columns_configured;
|
||||
}
|
||||
pub const toggle_highlight_columns_meta: Meta = .{ .description = "Toggle highlight columns" };
|
||||
|
||||
pub fn toggle_input_mode(self: *Self, _: Ctx) Result {
|
||||
var it = std.mem.splitScalar(u8, self.config_.input_mode, '/');
|
||||
self.config_.input_mode = it.first();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue