mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-07 02:51:50 +00:00
fix(tui): handle empty bracketed paste fallback (#15594)
This commit is contained in:
parent
5d2f9b5d7d
commit
124da27767
2 changed files with 3 additions and 3 deletions
|
|
@ -927,8 +927,8 @@ export function TextInput({
|
||||||
} else {
|
} else {
|
||||||
v = v.slice(0, c)
|
v = v.slice(0, c)
|
||||||
}
|
}
|
||||||
} else if (inp.length > 0) {
|
} else if (event.keypress.isPasted || inp.length > 0) {
|
||||||
const bracketed = inp.includes('[200~')
|
const bracketed = event.keypress.isPasted || inp.includes('[200~')
|
||||||
const text = inp.replace(BRACKET_PASTE, '').replace(/\r\n/g, '\n').replace(/\r/g, '\n')
|
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 })) {
|
if (bracketed && emitPaste({ bracketed: true, cursor: c, text, value: v })) {
|
||||||
|
|
|
||||||
2
ui-tui/src/types/hermes-ink.d.ts
vendored
2
ui-tui/src/types/hermes-ink.d.ts
vendored
|
|
@ -28,7 +28,7 @@ declare module '@hermes/ink' {
|
||||||
export type InputEvent = {
|
export type InputEvent = {
|
||||||
readonly input: string
|
readonly input: string
|
||||||
readonly key: Key
|
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
|
export type InputHandler = (input: string, key: Key, event: InputEvent) => void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue