fix(tui): route Ctrl+K and Ctrl+W through macOS readline fallback

Makes Ctrl+K and Ctrl+W work in hermes --tui mode in macOS
This commit is contained in:
Dylan Socolobsky 2026-04-22 11:14:36 -03:00 committed by Teknium
parent b49a1b71a7
commit ea9ddecc72
3 changed files with 31 additions and 7 deletions

View file

@ -634,6 +634,8 @@ export function TextInput({
const actionHome = k.home || (!isMac && mod && inp === 'a') || isMacActionFallback(k, inp, 'a')
const actionEnd = k.end || (mod && inp === 'e') || isMacActionFallback(k, inp, 'e')
const actionDeleteToStart = (mod && inp === 'u') || isMacActionFallback(k, inp, 'u')
const actionKillToEnd = (mod && inp === 'k') || isMacActionFallback(k, inp, 'k')
const actionDeleteWord = (mod && inp === 'w') || isMacActionFallback(k, inp, 'w')
const range = selRange()
const delFwd = k.delete || fwdDel.current
@ -697,7 +699,7 @@ export function TextInput({
} else {
v = v.slice(0, c) + v.slice(nextPos(v, c))
}
} else if (mod && inp === 'w') {
} else if (actionDeleteWord) {
if (range) {
v = v.slice(0, range.start) + v.slice(range.end)
c = range.start
@ -717,7 +719,7 @@ export function TextInput({
v = v.slice(c)
c = 0
}
} else if (mod && inp === 'k') {
} else if (actionKillToEnd) {
if (range) {
v = v.slice(0, range.start) + v.slice(range.end)
c = range.start