Skip to content

Commit a085af2

Browse files
committed
Handle more cases of adding to input history
1 parent 9035cdd commit a085af2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cli/src/commands/router.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ export async function routeUserPrompt(
256256
// Handle bash commands from queue (starts with '!')
257257
if (trimmed.startsWith('!') && trimmed.length > 1) {
258258
const command = trimmed.slice(1)
259+
saveToHistory(trimmed)
260+
setInputValue({ text: '', cursorPosition: 0, lastEditDueToNav: false })
259261
runBashCommand(command)
260262
return
261263
}

cli/src/hooks/use-input-history.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export const useInputHistory = (
5050
}, [])
5151

5252
const saveToHistory = useCallback((message: string) => {
53-
const newHistory = [...messageHistoryRef.current, message]
53+
// Re-read from disk to pick up messages from other terminals
54+
const diskHistory = loadMessageHistory()
55+
const newHistory = [...diskHistory, message]
5456
messageHistoryRef.current = newHistory
5557
historyIndexRef.current = -1
5658
currentDraftRef.current = ''

0 commit comments

Comments
 (0)