shift-click extends selection

This commit is contained in:
Mitchell Hashimoto
2023-03-21 21:12:15 -07:00
parent ae0738f0a9
commit 5f5700259f
2 changed files with 11 additions and 1 deletions

View File

@ -18,7 +18,6 @@ Correctness:
Improvements: Improvements:
* scrollback: configurable * scrollback: configurable
* shift-click and drag to continue selection
Mac: Mac:

View File

@ -1514,6 +1514,17 @@ pub fn mouseButtonCallback(
self.mouse.click_state[@intCast(usize, @enumToInt(button))] = action; self.mouse.click_state[@intCast(usize, @enumToInt(button))] = action;
self.mouse.mods = @bitCast(input.Mods, mods); 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(); self.renderer_state.mutex.lock();
defer self.renderer_state.mutex.unlock(); defer self.renderer_state.mutex.unlock();