mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: rectangle select only requires option + drag
Fixes #2537 This matches Terminal.app. iTerm2 requires cmd+option (our old behavior). Kitty doesn't seem to support rectangle select or I couldn't figure out how to make it work. WezTerm matches Terminal.app too. Outside of terminal emulators, this is also the rectangular select binding for neovim.
This commit is contained in:
@ -3468,7 +3468,7 @@ fn dragLeftClickSingle(
|
||||
try self.setSelection(if (selected) terminal.Selection.init(
|
||||
drag_pin,
|
||||
drag_pin,
|
||||
self.mouse.mods.ctrlOrSuper() and self.mouse.mods.alt,
|
||||
SurfaceMouse.isRectangleSelectState(self.mouse.mods),
|
||||
) else null);
|
||||
|
||||
return;
|
||||
@ -3503,7 +3503,7 @@ fn dragLeftClickSingle(
|
||||
try self.setSelection(terminal.Selection.init(
|
||||
start,
|
||||
drag_pin,
|
||||
self.mouse.mods.ctrlOrSuper() and self.mouse.mods.alt,
|
||||
SurfaceMouse.isRectangleSelectState(self.mouse.mods),
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
@ -113,14 +113,19 @@ fn eligibleMouseShapeKeyEvent(physical_key: input.Key) bool {
|
||||
physical_key.leftOrRightAlt();
|
||||
}
|
||||
|
||||
fn isRectangleSelectState(mods: input.Mods) bool {
|
||||
return mods.ctrlOrSuper() and mods.alt;
|
||||
}
|
||||
|
||||
fn isMouseModeOverrideState(mods: input.Mods) bool {
|
||||
return mods.shift;
|
||||
}
|
||||
|
||||
/// Returns true if our modifiers put us in a state where dragging
|
||||
/// should cause a rectangle select.
|
||||
pub fn isRectangleSelectState(mods: input.Mods) bool {
|
||||
return if (comptime builtin.target.isDarwin())
|
||||
mods.alt
|
||||
else
|
||||
mods.ctrlOrSuper() and mods.alt;
|
||||
}
|
||||
|
||||
test "keyToMouseShape" {
|
||||
const testing = std.testing;
|
||||
|
||||
|
Reference in New Issue
Block a user