@@ -8,10 +8,9 @@ import {
88 EXIT_ALT_BUFFER ,
99 CLEAR_SCREEN ,
1010 SHOW_CURSOR ,
11+ HIDE_CURSOR ,
1112 MOVE_CURSOR ,
1213 SET_CURSOR_DEFAULT ,
13- DISABLE_CURSOR_BLINK ,
14- CURSOR_SET_INVISIBLE_BLOCK ,
1514} from '../utils/terminal'
1615
1716// Constants
@@ -225,11 +224,11 @@ function resetChatState(): void {
225224function setupRealCursor ( ) : void {
226225 if ( chatState . inputBarFocused ) {
227226 // Show cursor when input bar is focused
227+ process . stdout . write ( SHOW_CURSOR )
228228 process . stdout . write ( SET_CURSOR_DEFAULT )
229229 } else {
230230 // Hide cursor when navigating toggles
231- process . stdout . write ( CURSOR_SET_INVISIBLE_BLOCK )
232- process . stdout . write ( DISABLE_CURSOR_BLINK )
231+ process . stdout . write ( HIDE_CURSOR )
233232 }
234233}
235234
@@ -239,13 +238,13 @@ function restoreDefaultRealCursor(): void {
239238}
240239
241240function positionRealCursor ( ) : void {
242- // Only position cursor if input bar is focused
243241 if ( ! chatState . inputBarFocused ) {
244242 return
245243 }
246244
247- // Position cursor at the input area where typing occurs
248245 const metrics = getTerminalMetrics ( )
246+
247+ // Position cursor at the input area where typing occurs
249248 const inputAreaHeight = calculateInputAreaHeight ( metrics )
250249
251250 // Calculate where the input area starts
@@ -1567,12 +1566,10 @@ function handleTabNavigation(key: any): boolean {
15671566
15681567 if ( key . shift ) {
15691568 // Shift+Tab: backward (previous target)
1570- currentIndex =
1571- currentIndex <= 0 ? allTargets . length - 1 : currentIndex - 1
1569+ currentIndex = currentIndex <= 0 ? allTargets . length - 1 : currentIndex - 1
15721570 } else {
15731571 // Tab: forward (next target)
1574- currentIndex =
1575- currentIndex >= allTargets . length - 1 ? 0 : currentIndex + 1
1572+ currentIndex = currentIndex >= allTargets . length - 1 ? 0 : currentIndex + 1
15761573 }
15771574
15781575 const targetNode = allTargets [ currentIndex ]
@@ -1744,7 +1741,12 @@ function collectToggleNodesFromTree(
17441741 node : SubagentNode ,
17451742 messageId : string ,
17461743 uiState : SubagentUIState ,
1747- targets : Array < { messageId : string | null ; nodeId : string ; depth : number ; type : 'toggle' | 'input' } > ,
1744+ targets : Array < {
1745+ messageId : string | null
1746+ nodeId : string
1747+ depth : number
1748+ type : 'toggle' | 'input'
1749+ } > ,
17481750 depth : number ,
17491751 path : number [ ] = [ ] ,
17501752) : void {
@@ -1805,21 +1807,21 @@ function getCurrentFocusedToggleNodeId(): string | null {
18051807
18061808function clearAllFocus ( ) : boolean {
18071809 let hadFocus = false
1808-
1810+
18091811 // Clear input bar focus
18101812 if ( chatState . inputBarFocused ) {
18111813 chatState . inputBarFocused = false
18121814 hadFocus = true
18131815 }
1814-
1816+
18151817 // Clear toggle focus
18161818 chatState . messages . forEach ( ( message ) => {
18171819 if ( message . subagentUIState ?. focusNodeId ) {
18181820 message . subagentUIState . focusNodeId = null
18191821 hadFocus = true
18201822 }
18211823 } )
1822-
1824+
18231825 return hadFocus
18241826}
18251827
@@ -1854,7 +1856,8 @@ function autoFocusLatestToggle(): void {
18541856 if ( ! getCurrentFocusedToggleNodeId ( ) && chatState . inputBarFocused ) {
18551857 // Clear input bar focus and focus on the main assistant toggle
18561858 chatState . inputBarFocused = false
1857- message . subagentUIState . focusNodeId = createNodeId ( message . id , [ ] ) + '/toggle'
1859+ message . subagentUIState . focusNodeId =
1860+ createNodeId ( message . id , [ ] ) + '/toggle'
18581861 setupRealCursor ( )
18591862 }
18601863
0 commit comments