Skip to content

Only treat the platform's own chord as select-all - #15184

Open
ameyypawar wants to merge 2 commits into
gitbutlerapp:masterfrom
ameyypawar:fix/11435-mac-ctrl-a
Open

Only treat the platform's own chord as select-all#15184
ameyypawar wants to merge 2 commits into
gitbutlerapp:masterfrom
ameyypawar:fix/11435-mac-ctrl-a

Conversation

@ameyypawar

Copy link
Copy Markdown
Contributor

🧠 Changes

isSelectAllChord() decides whether a keydown is the current platform's select-all chord, and the global handler in +layout.svelte uses it in place of e.metaKey || e.ctrlKey. On macOS only ⌘ counts, everywhere else only Ctrl does. The platform comes from backend.platformName, which the desktop app reads from the OS rather than from the user agent.

Checked on macOS: Ctrl+A in the commit title now moves the cursor to the start of the line, and ⌘A still selects the field.

☕️ Reasoning

macOS text fields carry the emacs bindings, where Ctrl+A moves to the start of the line and Ctrl+E to the end. The handler hand-rolls select-all because Tauri gets in the way of the default behaviour, and it accepted either modifier, so on macOS Ctrl+A selected the whole field instead of moving the cursor. That takes an editing key away rather than adding a shortcut.

It only fires for HTMLInputElement and HTMLTextAreaElement, which is why the report singles out the commit title, branch rename and new branch boxes while the commit message box behaves normally: that one is a Lexical contenteditable and never reaches this branch.

Off macOS Ctrl+A is unchanged. Meta+A no longer selects, which was only reachable through the Super/Windows key.

🎫 Affected issues

Fixes: #11435

macOS selects all with the command key and keeps Ctrl+A for "move to the
start of the line", so accepting either modifier took that editing key
away from every input and textarea in the app, the commit title, branch
rename and new branch boxes among them.

The platform comes from the backend, which reads it from the OS rather
than from the user agent.
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.

Minor: On mac, in a text field, ctrl-a should move the cursor to the start of the line, not select-all

1 participant