mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-25 13:16:11 +03:00
mouse shift-click only continues previous event if selection is active
This commit is contained in:
@ -1575,14 +1575,25 @@ pub fn mouseButtonCallback(
|
|||||||
self.mouse.click_state[@intCast(usize, @intFromEnum(button))] = action;
|
self.mouse.click_state[@intCast(usize, @intFromEnum(button))] = action;
|
||||||
self.mouse.mods = @bitCast(input.Mods, mods);
|
self.mouse.mods = @bitCast(input.Mods, mods);
|
||||||
|
|
||||||
// Shift-click continues the previous mouse state. cursorPosCallback
|
// Shift-click continues the previous mouse state if we have a selection.
|
||||||
// will also do a mouse report so we don't need to do any the logic
|
// cursorPosCallback will also do a mouse report so we don't need to do any
|
||||||
// below.
|
// of the logic below.
|
||||||
if (button == .left and action == .press) {
|
if (button == .left and action == .press) {
|
||||||
if (mods.shift and self.mouse.left_click_count > 0) {
|
if (mods.shift and self.mouse.left_click_count > 0) {
|
||||||
const pos = try self.rt_surface.getCursorPos();
|
// Checking for selection requires the renderer state mutex which
|
||||||
try self.cursorPosCallback(pos);
|
// sucks but this should be pretty rare of an event so it won't
|
||||||
return;
|
// cause a ton of contention.
|
||||||
|
const selection = selection: {
|
||||||
|
self.renderer_state.mutex.lock();
|
||||||
|
defer self.renderer_state.mutex.unlock();
|
||||||
|
break :selection self.io.terminal.screen.selection != null;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (selection) {
|
||||||
|
const pos = try self.rt_surface.getCursorPos();
|
||||||
|
try self.cursorPosCallback(pos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user