fix: store button click locations as signed values
This commit is contained in:
parent
e6cc1c35f9
commit
25a719382f
22 changed files with 36 additions and 36 deletions
|
|
@ -62,7 +62,7 @@ pub fn ctx_deinit(self: *Self) void {
|
|||
if (self.behind) |p| self.allocator.free(p);
|
||||
}
|
||||
|
||||
fn on_click(self: *Self, _: *ButtonType, _: Button.Cursor) void {
|
||||
fn on_click(self: *Self, _: *ButtonType, _: Widget.Pos) void {
|
||||
self.refresh_git_status();
|
||||
command.executeName("show_git_status", .{}) catch {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ pub fn create(allocator: Allocator, parent: Plane, event_handler: ?EventHandler,
|
|||
});
|
||||
}
|
||||
|
||||
fn on_click(_: *Self, _: *ButtonType, _: Button.Cursor) void {
|
||||
fn on_click(_: *Self, _: *ButtonType, _: Widget.Pos) void {
|
||||
command.executeName("show_diagnostics", .{}) catch {};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,15 +65,15 @@ pub fn create(allocator: Allocator, parent: Plane, event_handler: ?EventHandler,
|
|||
return Widget.to(btn);
|
||||
}
|
||||
|
||||
fn on_click(_: *Self, _: *ButtonType, _: Button.Cursor) void {
|
||||
fn on_click(_: *Self, _: *ButtonType, _: Widget.Pos) void {
|
||||
command.executeName("open_recent", .{}) catch {};
|
||||
}
|
||||
|
||||
fn on_click2(_: *Self, _: *ButtonType, _: Button.Cursor) void {
|
||||
fn on_click2(_: *Self, _: *ButtonType, _: Widget.Pos) void {
|
||||
command.executeName("close_file", .{}) catch {};
|
||||
}
|
||||
|
||||
fn on_click3(self: *Self, _: *ButtonType, _: Button.Cursor) void {
|
||||
fn on_click3(self: *Self, _: *ButtonType, _: Widget.Pos) void {
|
||||
self.detailed = !self.detailed;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ pub fn create(allocator: Allocator, parent: Plane, event_handler: ?EventHandler,
|
|||
});
|
||||
}
|
||||
|
||||
fn on_click(_: *Self, _: *ButtonType, _: Button.Cursor) void {
|
||||
fn on_click(_: *Self, _: *ButtonType, _: Widget.Pos) void {
|
||||
command.executeName("goto", .{}) catch {};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ fn render_logo(self: *ButtonType, theme: *const Widget.Theme, style_label: Widge
|
|||
}
|
||||
}
|
||||
|
||||
fn on_click(_: *Style, _: *ButtonType, _: Button.Cursor) void {
|
||||
fn on_click(_: *Style, _: *ButtonType, _: Widget.Pos) void {
|
||||
if (is_mini_mode()) {
|
||||
command.executeName("exit_mini_mode", .{}) catch {};
|
||||
} else if (is_overlay_mode()) {
|
||||
|
|
@ -115,6 +115,6 @@ fn on_click(_: *Style, _: *ButtonType, _: Button.Cursor) void {
|
|||
}
|
||||
}
|
||||
|
||||
fn toggle_panel(_: *Style, _: *ButtonType, _: Button.Cursor) void {
|
||||
fn toggle_panel(_: *Style, _: *ButtonType, _: Widget.Pos) void {
|
||||
command.executeName("toggle_panel", .{}) catch {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -353,14 +353,14 @@ const Tab = struct {
|
|||
});
|
||||
}
|
||||
|
||||
fn on_click(self: *@This(), _: *ButtonType, pos: Button.Cursor) void {
|
||||
fn on_click(self: *@This(), _: *ButtonType, pos: Widget.Pos) void {
|
||||
const buffer_manager = tui.get_buffer_manager() orelse @panic("tabs no buffer manager");
|
||||
if (buffer_manager.buffer_from_ref(self.buffer_ref)) |buffer| {
|
||||
if (self.close_pos) |close_pos| if (pos.col == close_pos) {
|
||||
if (self.close_pos) |close_pos| if (pos.x == close_pos) {
|
||||
tp.self_pid().send(.{ "cmd", "close_buffer", .{buffer.get_file_path()} }) catch {};
|
||||
return;
|
||||
};
|
||||
if (self.save_pos) |save_pos| if (pos.col == save_pos) {
|
||||
if (self.save_pos) |save_pos| if (pos.x == save_pos) {
|
||||
tp.self_pid().send(.{ "cmd", "save_buffer", .{buffer.get_file_path()} }) catch {};
|
||||
return;
|
||||
};
|
||||
|
|
@ -368,7 +368,7 @@ const Tab = struct {
|
|||
}
|
||||
}
|
||||
|
||||
fn on_click2(self: *@This(), _: *ButtonType, _: Button.Cursor) void {
|
||||
fn on_click2(self: *@This(), _: *ButtonType, _: Widget.Pos) void {
|
||||
const buffer_manager = tui.get_buffer_manager() orelse @panic("tabs no buffer manager");
|
||||
if (buffer_manager.buffer_from_ref(self.buffer_ref)) |buffer|
|
||||
tp.self_pid().send(.{ "cmd", "close_buffer", .{buffer.get_file_path()} }) catch {};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue