mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
* fix(mobile): send terminal paste, keys and query replies like desktop * fix(mobile): encode Shift+Enter for the pane's negotiated keyboard modes The phone's xterm now tracks Kitty flags and modifyOtherKeys with desktop's tracker, seeded from the host snapshot. * fix(mobile): keep keyboard modes across terminal snapshots * fix(mobile): adopt snapshot keyboard modes with desktop's rule * refactor(terminal): share snapshot keyboard-mode adoption and mode mirroring * fix(mobile): compare terminal modes field by field instead of a dynamic read * refactor(mobile): share terminal display-mode adoption between snapshot and resize * fix(mobile): accept only known terminal display modes from the host
26 lines
816 B
TypeScript
26 lines
816 B
TypeScript
export const TERMINAL_KITTY_SHIFT_ENTER_INPUT = '\x1b[13;2u'
|
||
|
||
/** Ctrl+Backspace deletes the previous word, like readline's Ctrl+W. */
|
||
export const TERMINAL_CTRL_BACKSPACE_INPUT = '\x17'
|
||
|
||
/** ESC CR depends on Pi’s private Kitty-query result, which panes cannot observe. Armed modifyOtherKeys uses CSI 27;mod;13~ consistently in either state (STA-7701). */
|
||
export function encodeModifyOtherKeysEnter(
|
||
modifyOtherKeys: number,
|
||
modifier: 2 | 3
|
||
): string | null {
|
||
return modifyOtherKeys > 0 ? `\x1b[27;${modifier};13~` : null
|
||
}
|
||
|
||
export function encodeTerminalShiftEnter({
|
||
canSendCsiU,
|
||
modifyOtherKeys
|
||
}: {
|
||
canSendCsiU: boolean
|
||
modifyOtherKeys: number
|
||
}): string {
|
||
if (canSendCsiU) {
|
||
return TERMINAL_KITTY_SHIFT_ENTER_INPUT
|
||
}
|
||
return encodeModifyOtherKeysEnter(modifyOtherKeys, 2) ?? '\x1b\r'
|
||
}
|