mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
8fd7ff6475
"Use Option as Meta key" was read into `altIsMeta` but only applied to the mouse alt-click options (`altClickMovesCursor`). xterm.js's `macOptionIsMeta` — the option that actually makes Option emit ESC-prefixed (Meta) sequences — was never set, so on macOS Option kept producing layout characters (ƒ, ∫, …) and readline/zle word shortcuts (Alt+f, Alt+b, Alt+Backspace) were dead. Extract the altAsMeta→xterm mapping into one tested helper used by both the terminal init path (createXTermRuntime) and the live settings sync (Terminal.tsx) so the two can't drift again. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
21 lines
763 B
TypeScript
21 lines
763 B
TypeScript
export interface TerminalAltKeyOptions {
|
|
/** xterm.js: treat macOS Option as the Meta key (emit ESC-prefixed sequences). */
|
|
macOptionIsMeta: boolean;
|
|
/** xterm.js: Option+click moves the cursor. Must be off when Option is Meta. */
|
|
altClickMovesCursor: boolean;
|
|
}
|
|
|
|
/**
|
|
* Map the user's "Use Option as Meta key" setting to xterm.js options.
|
|
*
|
|
* Kept in one place so terminal init (createXTermRuntime) and the live settings
|
|
* sync (Terminal.tsx) can't drift — that drift is what left `macOptionIsMeta`
|
|
* unset everywhere and broke Option/Meta shortcuts on macOS (issue #1078).
|
|
*/
|
|
export function terminalAltKeyOptions(altAsMeta: boolean): TerminalAltKeyOptions {
|
|
return {
|
|
macOptionIsMeta: altAsMeta,
|
|
altClickMovesCursor: !altAsMeta,
|
|
};
|
|
}
|