@@ -141,8 +141,7 @@ type UI struct {
141 // isCanceling tracks whether the user has pressed escape once to cancel.
141 // isCanceling tracks whether the user has pressed escape once to cancel.
142 isCanceling bool
142 isCanceling bool
144− // header is the last cached header logo
144+ header *header
147 // sendProgressBar instructs the TUI to send progress bar updates to the
146 // sendProgressBar instructs the TUI to send progress bar updates to the
148 // terminal.
147 // terminal.
@@ -261,12 +260,15 @@ func New(com *common.Common) *UI {
263+ header := newHeader(com)
264 ui := &UI{
265 ui := &UI{
265 com: com,
266 com: com,
266 dialog: dialog.NewOverlay(),
267 dialog: dialog.NewOverlay(),
267 keyMap: keyMap,
268 keyMap: keyMap,
268 textarea: ta,
269 textarea: ta,
269 chat: ch,
270 chat: ch,
270 completions: comp,
272 completions: comp,
271 attachments: attachments,
273 attachments: attachments,
272 todoSpinner: todoSpinner,
274 todoSpinner: todoSpinner,
@@ -325,6 +327,10 @@ func (m *UI) Init() tea.Cmd {
326// setState changes the UI state and focus.
328// setState changes the UI state and focus.
327func (m *UI) setState(state uiState, focus uiFocusState) {
329func (m *UI) setState(state uiState, focus uiFocusState) {
330+ if state == uiLanding {
331+ // Always turn off compact mode when going to landing
328 m.state = state
334 m.state = state
329 m.focus = focus
335 m.focus = focus
330 // Changing the state may change layout, so update it.
336 // Changing the state may change layout, so update it.
@@ -1761,6 +1767,18 @@ func (m *UI) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
1761 return tea.Batch(cmds...)
1767 return tea.Batch(cmds...)
1770+// drawHeader draws the header section of the UI.
1771+func (m *UI) drawHeader(scr uv.Screen, area uv.Rectangle) {
1772+ m.header.drawHeader(
1764// Draw implements [uv.Drawable] and draws the UI model.
1782// Draw implements [uv.Drawable] and draws the UI model.
1765func (m *UI) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
1783func (m *UI) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
1766 layout := m.generateLayout(area.Dx(), area.Dy())
1784 layout := m.generateLayout(area.Dx(), area.Dy())
@@ -1775,22 +1793,19 @@ func (m *UI) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
1776 switch m.state {
1794 switch m.state {
1777 case uiOnboarding:
1795 case uiOnboarding:
1778− header := uv.NewStyledString(m.header)
1779− header.Draw(scr, layout.header)
1796+ m.drawHeader(scr, layout.header)
1781 // NOTE: Onboarding flow will be rendered as dialogs below, but
1798 // NOTE: Onboarding flow will be rendered as dialogs below, but
1782 // positioned at the bottom left of the screen.
1799 // positioned at the bottom left of the screen.
1784 case uiInitialize:
1801 case uiInitialize:
1785− header := uv.NewStyledString(m.header)
1786− header.Draw(scr, layout.header)
1802+ m.drawHeader(scr, layout.header)
1788 main := uv.NewStyledString(m.initializeView())
1804 main := uv.NewStyledString(m.initializeView())
1789 main.Draw(scr, layout.main)
1805 main.Draw(scr, layout.main)
1791 case uiLanding:
1807 case uiLanding:
1792− header := uv.NewStyledString(m.header)
1793− header.Draw(scr, layout.header)
1808+ m.drawHeader(scr, layout.header)
1794 main := uv.NewStyledString(m.landingView())
1809 main := uv.NewStyledString(m.landingView())
1795 main.Draw(scr, layout.main)
1810 main.Draw(scr, layout.main)
@@ -1799,8 +1814,7 @@ func (m *UI) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
1800 case uiChat:
1815 case uiChat:
1801 if m.isCompact {
1816 if m.isCompact {
1802− header := uv.NewStyledString(m.header)
1803− header.Draw(scr, layout.header)
1817+ m.drawHeader(scr, layout.header)
1804 } else {
1818 } else {
1805 m.drawSidebar(scr, layout.sidebar)
1819 m.drawSidebar(scr, layout.sidebar)
@@ -2177,14 +2191,9 @@ func (m *UI) updateSize() {
2178 // Handle different app states
2192 // Handle different app states
2179 switch m.state {
2193 switch m.state {
2180− case uiOnboarding, uiInitialize, uiLanding:
2181− m.renderHeader(false, m.layout.header.Dx())
2183 case uiChat:
2194 case uiChat:
2184− if m.isCompact {
2195+ if !m.isCompact {
2185− m.renderHeader(true, m.layout.header.Dx())
2187− m.renderSidebarLogo(m.layout.sidebar.Dx())
2196+ m.cacheSidebarLogo(m.layout.sidebar.Dx())
@@ -2590,18 +2599,8 @@ func (m *UI) renderEditorView(width int) string {
2593−// renderHeader renders and caches the header logo at the specified width.
2594−func (m *UI) renderHeader(compact bool, width int) {
2595− if compact && m.session != nil && m.com.App != nil {
2596− m.header = renderCompactHeader(m.com, m.session, m.com.App.LSPClients, m.detailsOpen, width)
2598− m.header = renderLogo(m.com.Styles, compact, width)
2602−// renderSidebarLogo renders and caches the sidebar logo at the specified
2602+// cacheSidebarLogo renders and caches the sidebar logo at the specified width.
2604−func (m *UI) renderSidebarLogo(width int) {
2603+func (m *UI) cacheSidebarLogo(width int) {
2605 m.sidebarLogo = renderLogo(m.com.Styles, true, width)
2604 m.sidebarLogo = renderLogo(m.com.Styles, true, width)