Skip to content

fix(text_field): alias Meta modifier to Ctrl for Cmd+A/C/V/X#92

Open
KoalaHao wants to merge 1 commit into
Norbert515:mainfrom
marsup-space:fix/cmd-a-c-v-x
Open

fix(text_field): alias Meta modifier to Ctrl for Cmd+A/C/V/X#92
KoalaHao wants to merge 1 commit into
Norbert515:mainfrom
marsup-space:fix/cmd-a-c-v-x

Conversation

@KoalaHao

Copy link
Copy Markdown
Contributor

On the kitty keyboard protocol the macOS Cmd key arrives as a
super/Meta modifier, so Cmd+A/C/V/X reached TextField with
meta: true and fell through to the character-insertion branch,
typing a literal a / c / v / x into the field instead of
selecting / copying / cutting / pasting. macOS GUI users expect
Cmd to be the platform modifier for clipboard/selection just like
Ctrl is on Linux/Windows.

Accept either ctrl: true or meta: true on the select-all,
copy, cut, and paste handlers. Cmd+W and Cmd+T are
intentionally NOT aliased — those keep their macOS conventions
(close window / new tab) and must keep falling through.

This is orthogonal to PR #90 (kitty 4-part IME associated text);
both are valuable but neither supersedes the other. The Cmd
keybinding here is purely about the kitty 2-/3-part form
that iTerm2 / WezTerm / Ghostty / Kitty emit on every
Cmd+A/C/V/X press, regardless of any IME context.

Tests:

  • Cmd+A extends the selection (alias for Ctrl+A)
  • Cmd+C does NOT insert a literal 'c' (paste path is taken)
  • Cmd+V does NOT insert a literal 'v'
  • Cmd+X does NOT insert a literal 'x'
  • Cmd+W is NOT delete-word (macOS close-window convention)
  • Cmd+T is NOT transpose (macOS new-tab convention)
  • Plain Ctrl+C still bubbles up to the app quit handler

Cherry-picked from dddf6ac (marsup-space main) onto upstream
main as a standalone change. PR Norbert515#90 (kitty 4-part IME) does not
touch the Cmd+key path, but the user's expectation that Cmd+C
works like on macOS GUI is independent and equally broken on
stock nocterm — so this belongs in its own PR.

On the kitty keyboard protocol the macOS Cmd key arrives as a
super/Meta modifier, so Cmd+A/C/V/X reached TextField with
meta=true and fell through to the character-insertion branch
— typing a literal 'a' / 'c' / 'v' / 'x' into the field instead
of selecting / copying / cutting / pasting. macOS GUI users
expect Cmd to be the platform modifier for clipboard/selection
just like Ctrl is on Linux/Windows.

Accept either ctrl: true or meta: true on the select-all, copy,
cut, and paste handlers. Cmd+W and Cmd+T are intentionally NOT
aliased because macOS already uses those for 'close window' /
'new tab'; they must keep falling through.

Pairs with the meta-A regression guard: Ctrl+C still bubbles up
to the app quit handler (unchanged).

Adds test/components/text_field_meta_keybindings_test.dart
with 6 cases: Cmd+A selects, Cmd+C doesn't insert 'c', Cmd+V
doesn't insert 'v', Cmd+X doesn't insert 'x', Cmd+W is NOT
delete-word, Cmd+T is NOT transpose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant