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:
CJ van den Berg 2025-11-10 14:10:00 +01:00
parent 36c975dc20
commit 7d740bfa2a
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 6 additions and 0 deletions

View file

@ -2502,6 +2502,7 @@ pub const Editor = struct {
self.clamp_mouse();
try self.send_editor_jump_destination();
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 {

View file

@ -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;
}
pub fn reset_input_idle_timer() void {
const self = current();
self.update_input_idle_timer();
}
fn update_mouse_idle_timer(self: *Self) void {
if (!self.enable_mouse_idle_timer) return;
const delay = std.time.us_per_ms * @as(u64, mouse_idle_time_milliseconds);