fix: reset input idle timer when placing the cursor in an editor with the mouse
This is so that mouse clicks inside an editor widget may also trigger configured idle_actions.
This commit is contained in:
parent
36c975dc20
commit
7d740bfa2a
2 changed files with 6 additions and 0 deletions
|
|
@ -2502,6 +2502,7 @@ pub const Editor = struct {
|
||||||
self.clamp_mouse();
|
self.clamp_mouse();
|
||||||
try self.send_editor_jump_destination();
|
try self.send_editor_jump_destination();
|
||||||
if (self.jump_mode) try self.goto_definition(.{});
|
if (self.jump_mode) try self.goto_definition(.{});
|
||||||
|
tui.reset_input_idle_timer();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn primary_double_click(self: *Self, y: c_int, x: c_int) !void {
|
pub fn primary_double_click(self: *Self, y: c_int, x: c_int) !void {
|
||||||
|
|
|
||||||
|
|
@ -321,6 +321,11 @@ fn update_input_idle_timer(self: *Self) void {
|
||||||
self.input_idle_timer = tp.self_pid().delay_send_cancellable(self.allocator, "tui.input_idle_timer", delay, .{"INPUT_IDLE"}) catch return;
|
self.input_idle_timer = tp.self_pid().delay_send_cancellable(self.allocator, "tui.input_idle_timer", delay, .{"INPUT_IDLE"}) catch return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn reset_input_idle_timer() void {
|
||||||
|
const self = current();
|
||||||
|
self.update_input_idle_timer();
|
||||||
|
}
|
||||||
|
|
||||||
fn update_mouse_idle_timer(self: *Self) void {
|
fn update_mouse_idle_timer(self: *Self) void {
|
||||||
if (!self.enable_mouse_idle_timer) return;
|
if (!self.enable_mouse_idle_timer) return;
|
||||||
const delay = std.time.us_per_ms * @as(u64, mouse_idle_time_milliseconds);
|
const delay = std.time.us_per_ms * @as(u64, mouse_idle_time_milliseconds);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue