Skip to content

Commit e8eaabe

Browse files
committed
fix(cli): invert Ctrl+T toggle priority to collapse-first
Change the toggle-all behavior so that Ctrl+T primarily collapses open subagent toggles. Only expands all when everything is already collapsed. Previous behavior: - Any expanded → collapse all - All collapsed → expand all New behavior: - Any expanded → collapse all (primary action) - All collapsed → expand all (only when everything closed) This fixes the issue where users had to press Ctrl+T twice to collapse toggles in certain states.
1 parent 9c26370 commit e8eaabe

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cli/src/hooks/use-chat-messages.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,16 @@ export function useChatMessages({
203203

204204
/**
205205
* Toggles all collapsible blocks in all AI responses.
206-
* If any block is expanded, collapses all. Otherwise expands all.
206+
* Primary action is to collapse all. Only expands if everything is already collapsed.
207207
*/
208208
const handleToggleAll = useCallback(() => {
209209
isUserCollapsingRef.current = true
210210

211211
setMessages((prevMessages) => {
212-
// Determine target state: if any expanded, collapse all; otherwise expand all
213-
const shouldCollapse = hasAnyExpandedBlocks(prevMessages)
212+
// Primary action: collapse all open blocks
213+
// Only expand if everything is already collapsed
214+
const allCollapsed = !hasAnyExpandedBlocks(prevMessages)
215+
const shouldCollapse = !allCollapsed
214216
return setAllBlocksCollapsedState(prevMessages, shouldCollapse)
215217
})
216218

0 commit comments

Comments
 (0)