From 78420119df0e4fa68b0d68438627d0ef450e9b7c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 23 Nov 2023 14:46:09 -0800 Subject: [PATCH] core: clear selection on mouse cursor keys Fixes #939 --- src/Surface.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Surface.zig b/src/Surface.zig index 173ace394..d730f8e0e 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -1414,6 +1414,10 @@ pub fn scrollCallback( self.io.terminal.modes.get(.mouse_alternate_scroll)) { if (y.delta_unsigned > 0) { + // When we send mouse events as cursor keys we always + // clear the selection. + self.setSelection(null); + const seq = if (y.delta < 0) "\x1bOA" else "\x1bOB"; for (0..y.delta_unsigned) |_| { _ = self.io_thread.mailbox.push(.{