on main help sign in
Merge pull request #210 from charmbracelet/charm-373

fix(tui): chat: fix compact mode details toggle

commit859e95a71dee2f28b55211c9b29feef8bc4bfd84 authorKujtim Hoxha <kujtimii.h@gmail.com> dateWed 16 Jul 2025, 22:16 (1 year ago) parent22094cb806d21e
1 file changed+12−8
internal/tui/page/chat/chat.go+12−8
internal/tui/page/chat/chat.go+12−8
@@ -275,7 +275,7 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
275275 return p, p.cancel()
276276 }
277277 case key.Matches(msg, p.keyMap.Details):
278− p.showDetails()
278+ p.toggleDetails()
279279 return p, nil
280280 }
281281
@@ -446,12 +446,9 @@ func (p *chatPage) setCompactMode(compact bool) {
446446 }
447447 p.compact = compact
448448 if compact {
449− p.compact = true
450449 p.sidebar.SetCompactMode(true)
451450 } else {
452− p.compact = false
453− p.showingDetails = false
454− p.sidebar.SetCompactMode(false)
451+ p.setShowDetails(false)
455452 }
456453}
457454
@@ -558,12 +555,19 @@ func (p *chatPage) cancel() tea.Cmd {
558555 return cancelTimerCmd()
559556}
560557
561−func (p *chatPage) showDetails() {
558+func (p *chatPage) setShowDetails(show bool) {
559+ p.showingDetails = show
560+ p.header.SetDetailsOpen(p.showingDetails)
561+ if !p.compact {
562+ p.sidebar.SetCompactMode(false)
563+ }
564+}
565+
566+func (p *chatPage) toggleDetails() {
562567 if p.session.ID == "" || !p.compact {
563568 return
564569 }
565− p.showingDetails = !p.showingDetails
566− p.header.SetDetailsOpen(p.showingDetails)
570+ p.setShowDetails(!p.showingDetails)
567571}
568572
569573func (p *chatPage) sendMessage(text string, attachments []message.Attachment) tea.Cmd {