From 5f5700259f045f088df59cfe022a215c7fb3441d Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 21 Mar 2023 21:12:15 -0700 Subject: [PATCH] shift-click extends selection --- TODO.md | 1 - src/Surface.zig | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index c4f0055f4..37c53e7e2 100644 --- a/TODO.md +++ b/TODO.md @@ -18,7 +18,6 @@ Correctness: Improvements: * scrollback: configurable -* shift-click and drag to continue selection Mac: diff --git a/src/Surface.zig b/src/Surface.zig index d78e82483..80fd87ac6 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -1514,6 +1514,17 @@ pub fn mouseButtonCallback( self.mouse.click_state[@intCast(usize, @enumToInt(button))] = action; self.mouse.mods = @bitCast(input.Mods, mods); + // Shift-click continues the previous mouse state. cursorPosCallback + // will also do a mouse report so we don't need to do any the logic + // below. + if (button == .left and action == .press) { + if (mods.shift and self.mouse.left_click_count > 0) { + const pos = try self.rt_surface.getCursorPos(); + try self.cursorPosCallback(pos); + return; + } + } + self.renderer_state.mutex.lock(); defer self.renderer_state.mutex.unlock();