File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import { useTheme } from './hooks/use-theme'
4040import { useTimeout } from './hooks/use-timeout'
4141
4242import { useChatStore } from './state/chat-store'
43+ import { getInputModeConfig } from './utils/input-modes'
4344import { useFeedbackStore } from './state/feedback-store'
4445import { createChatScrollAcceleration } from './utils/chat-scroll-accel'
4546import { loadLocalAgents } from './utils/local-agent-registry'
@@ -885,10 +886,11 @@ export const Chat = ({
885886 [ messages ] ,
886887 )
887888
889+ const modeConfig = getInputModeConfig ( inputMode )
888890 const hasSlashSuggestions =
889891 slashContext . active &&
890892 slashSuggestionItems . length > 0 &&
891- inputMode === 'default'
893+ ! modeConfig . disableSlashSuggestions
892894 const hasMentionSuggestions =
893895 ! slashContext . active &&
894896 mentionContext . active &&
Original file line number Diff line number Diff line change 11import { useKeyboard } from '@opentui/react'
22import { useCallback } from 'react'
33
4+ import { useChatStore } from '../state/chat-store'
5+
46type InputHandle = { focus : ( ) => void }
57
68interface KeyboardHandlersConfig {
@@ -62,6 +64,21 @@ export const useKeyboardHandlers = ({
6264 return
6365 }
6466
67+ // Handle escape with empty input: exit current mode if not default
68+ if ( isEscape && ! isStreaming && ! isWaitingForResponse && ! inputValue . trim ( ) ) {
69+ const { inputMode, setInputMode } = useChatStore . getState ( )
70+ if ( inputMode !== 'default' ) {
71+ if (
72+ 'preventDefault' in key &&
73+ typeof key . preventDefault === 'function'
74+ ) {
75+ key . preventDefault ( )
76+ }
77+ setInputMode ( 'default' )
78+ return
79+ }
80+ }
81+
6582 if ( ( isEscape || isCtrlC ) && ( isStreaming || isWaitingForResponse ) ) {
6683 if (
6784 'preventDefault' in key &&
You can’t perform that action at this time.
0 commit comments