fix(tui): handle empty bracketed paste fallback (#15594)

This commit is contained in:
Gille 2026-04-28 13:30:08 -06:00 committed by GitHub
parent 5d2f9b5d7d
commit 124da27767
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -927,8 +927,8 @@ export function TextInput({
} else {
v = v.slice(0, c)
}
} else if (inp.length > 0) {
const bracketed = inp.includes('[200~')
} else if (event.keypress.isPasted || inp.length > 0) {
const bracketed = event.keypress.isPasted || inp.includes('[200~')
const text = inp.replace(BRACKET_PASTE, '').replace(/\r\n/g, '\n').replace(/\r/g, '\n')
if (bracketed && emitPaste({ bracketed: true, cursor: c, text, value: v })) {

View file

@ -28,7 +28,7 @@ declare module '@hermes/ink' {
export type InputEvent = {
readonly input: string
readonly key: Key
readonly keypress: { readonly raw?: string }
readonly keypress: { readonly isPasted?: boolean; readonly raw?: string }
}
export type InputHandler = (input: string, key: Key, event: InputEvent) => void