@@ -22,6 +22,7 @@ export default function MessageInput({
22
22
const [ sentChars , setSentChars ] = useState < SentChar [ ] > ( [ ] ) ;
23
23
const textareaRef = useRef < HTMLTextAreaElement > ( null ) ;
24
24
const nextCharId = useRef ( 0 ) ;
25
+ const [ controlAreaFocused , setControlAreaFocused ] = useState ( false ) ;
25
26
26
27
const handleSubmit = ( e : FormEvent ) => {
27
28
e . preventDefault ( ) ;
@@ -128,6 +129,9 @@ export default function MessageInput({
128
129
useEffect ( ( ) => {
129
130
if ( textareaRef . current ) {
130
131
textareaRef . current . focus ( ) ;
132
+ if ( inputMode === "control" ) {
133
+ setControlAreaFocused ( true ) ;
134
+ }
131
135
}
132
136
} , [ inputMode ] ) ;
133
137
@@ -162,6 +166,10 @@ export default function MessageInput({
162
166
Control
163
167
</ button >
164
168
</ div >
169
+ < span className = "ml-3 text-xs text-gray-600" >
170
+ Switch to < span className = "font-medium" > Control</ span > mode to send
171
+ raw keystrokes (↑,↓,Tab,Ctrl+C) directly to the terminal
172
+ </ span >
165
173
</ div >
166
174
167
175
{ inputMode === "control" && ! disabled && (
@@ -196,9 +204,13 @@ export default function MessageInput({
196
204
tabIndex = { 0 }
197
205
// eslint-disable-next-line @typescript-eslint/no-explicit-any
198
206
onKeyDown = { handleKeyDown as any }
207
+ onFocus = { ( ) => setControlAreaFocused ( true ) }
208
+ onBlur = { ( ) => setControlAreaFocused ( false ) }
199
209
className = "flex-1 cursor-text border rounded-lg p-2 focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-500 bg-gray-50 border-blue-200 min-h-[3.5rem] flex items-center justify-center"
200
210
>
201
- Press any key to send to terminal
211
+ { controlAreaFocused
212
+ ? "Press any key to send to terminal (arrows, Ctrl+C, etc.)"
213
+ : "Click or focus this area to send keystrokes to terminal" }
202
214
</ div >
203
215
) : (
204
216
< >
0 commit comments