mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
Previous fix in 9dbf1ec6 handled Ctrl+C inside textInput but the APP-level useInputHandlers fires the same keypress in a separate React hook and ran clearIn() regardless. Net effect: the OSC 52 copy succeeded but the input wiped right after, so Brooklyn only noticed the wipe. Lift the selection-aware Ctrl+C to a single place by threading input selection state through a new nanostore (src/app/inputSelectionStore.ts). textInput syncs its derived `selected` range + a clear() callback to the store on every selection change, and the app-level Ctrl+C handler reads the store before its clear/interrupt/die chain: - terminal-level selection (scrollback) → copy, existing behavior - in-input selection present → copy + clear selection, preserve input - input has text, no selection → clearIn(), existing behavior - empty + busy → interrupt turn - empty + idle → die textInput no longer has its own Ctrl+C block; keypress falls through to app-level like it did before 9dbf1ec6.
14 lines
358 B
TypeScript
14 lines
358 B
TypeScript
import { atom } from 'nanostores'
|
|
|
|
export interface InputSelection {
|
|
clear: () => void
|
|
end: number
|
|
start: number
|
|
value: string
|
|
}
|
|
|
|
export const $inputSelection = atom<InputSelection | null>(null)
|
|
|
|
export const setInputSelection = (next: InputSelection | null) => $inputSelection.set(next)
|
|
|
|
export const getInputSelection = () => $inputSelection.get()
|