mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-27 01:11:40 +00:00
fix(tui): use command shortcuts on macOS
Make the Ink TUI match macOS keyboard expectations: Command handles copy and common editor/session shortcuts, while Control remains reserved for interrupt/cancel flows. Update the visible hotkey help to show platform-appropriate labels.
This commit is contained in:
parent
dcd763c284
commit
8c9fdedaf5
4 changed files with 65 additions and 29 deletions
19
ui-tui/src/lib/platform.ts
Normal file
19
ui-tui/src/lib/platform.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/** Platform-aware keybinding helpers.
|
||||
*
|
||||
* On macOS the "action" modifier is Cmd (key.meta in Ink), on other platforms
|
||||
* it is Ctrl. Ctrl+C is ALWAYS the interrupt key regardless of platform —
|
||||
* it must never be remapped to copy.
|
||||
*/
|
||||
|
||||
export const isMac = process.platform === 'darwin'
|
||||
|
||||
/** The display label for the action modifier key. */
|
||||
export const modLabel = isMac ? '⌘' : 'Ctrl'
|
||||
|
||||
/** True when the platform action-modifier is pressed (Cmd on macOS, Ctrl elsewhere). */
|
||||
export const isActionMod = (key: { ctrl: boolean; meta: boolean }): boolean =>
|
||||
isMac ? key.meta : key.ctrl
|
||||
|
||||
/** Match action-modifier + a single character (case-insensitive). */
|
||||
export const isAction = (key: { ctrl: boolean; meta: boolean }, ch: string, target: string): boolean =>
|
||||
isActionMod(key) && ch.toLowerCase() === target
|
||||
Loading…
Add table
Add a link
Reference in a new issue