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:
@ -146,7 +146,7 @@ class BaseTerminalController: NSWindowController,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Notifications
|
// MARK: Notifications
|
||||||
|
|
||||||
@objc private func didChangeScreenParametersNotification(_ notification: Notification) {
|
@objc private func didChangeScreenParametersNotification(_ notification: Notification) {
|
||||||
// If we have a window that is visible and it is outside the bounds of the
|
// If we have a window that is visible and it is outside the bounds of the
|
||||||
// screen then we clamp it back to within the screen.
|
// screen then we clamp it back to within the screen.
|
||||||
|
@ -3468,7 +3468,7 @@ fn dragLeftClickSingle(
|
|||||||
try self.setSelection(if (selected) terminal.Selection.init(
|
try self.setSelection(if (selected) terminal.Selection.init(
|
||||||
drag_pin,
|
drag_pin,
|
||||||
drag_pin,
|
drag_pin,
|
||||||
self.mouse.mods.ctrlOrSuper() and self.mouse.mods.alt,
|
SurfaceMouse.isRectangleSelectState(self.mouse.mods),
|
||||||
) else null);
|
) else null);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -3503,7 +3503,7 @@ fn dragLeftClickSingle(
|
|||||||
try self.setSelection(terminal.Selection.init(
|
try self.setSelection(terminal.Selection.init(
|
||||||
start,
|
start,
|
||||||
drag_pin,
|
drag_pin,
|
||||||
self.mouse.mods.ctrlOrSuper() and self.mouse.mods.alt,
|
SurfaceMouse.isRectangleSelectState(self.mouse.mods),
|
||||||
));
|
));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -113,14 +113,19 @@ fn eligibleMouseShapeKeyEvent(physical_key: input.Key) bool {
|
|||||||
physical_key.leftOrRightAlt();
|
physical_key.leftOrRightAlt();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn isRectangleSelectState(mods: input.Mods) bool {
|
|
||||||
return mods.ctrlOrSuper() and mods.alt;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn isMouseModeOverrideState(mods: input.Mods) bool {
|
fn isMouseModeOverrideState(mods: input.Mods) bool {
|
||||||
return mods.shift;
|
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" {
|
test "keyToMouseShape" {
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user