Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/input/keybindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,27 @@ pub fn handle_key(
let ctrl = modifiers.state().control_key();
let shift = modifiers.state().shift_key();
let alt = modifiers.state().alt_key();
handle_key_inner(

// On macOS, Cmd (super) is the app-shortcut modifier (equivalent to Ctrl elsewhere).
let cmd = cfg!(target_os = "macos") && modifiers.state().super_key();

let action = handle_key_inner(
&event.logical_key,
ctrl,
ctrl || cmd,
shift,
alt,
mode,
grid_cols,
grid_rows,
application_cursor_keys,
)
);

// macOS: Cmd+key that doesn't match a shortcut is consumed, not forwarded to PTY.
if cmd && !ctrl && matches!(action, Action::SendToPty(_)) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if cmd && !ctrl && matches!(action, Action::SendToPty(_)) {
// macOS: Consume any Cmd+key that has no binding, even when Ctrl is also held.
// Without this, Cmd+Ctrl+<unmapped> would leak a control byte to the PTY.
if cmd && matches!(action, Action::SendToPty(_)) {

These two modifiers are orthogonal — CTRL and SUPER should be independent bits with no exclusion logic between them. The !ctrl guard should be dropped.

Also, I would change the comment mentioned before

Action::None
} else {
action
}
}

pub fn handle_ctrl_w(event: &KeyEvent) -> Action {
Expand Down