diff --git a/internal/tui/update.go b/internal/tui/update.go index 6768355..2f5514c 100644 --- a/internal/tui/update.go +++ b/internal/tui/update.go @@ -138,9 +138,10 @@ func (m *Model) handleTick(t time.Time) (tea.Model, tea.Cmd) { func (m *Model) handleMouse(msg tea.MouseMsg) (tea.Model, tea.Cmd) { if m.state == stateHistory { - if msg.Button == tea.MouseButtonWheelUp { + switch msg.Button { + case tea.MouseButtonWheelUp: m.historyViewport.ScrollUp(3) - } else if msg.Button == tea.MouseButtonWheelDown { + case tea.MouseButtonWheelDown: m.historyViewport.ScrollDown(3) } return m, nil @@ -266,13 +267,13 @@ func (m *Model) handleHistoryKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) { case "q", "esc": m.state = stateDetail case "up", "k": - m.historyViewport.LineUp(1) + m.historyViewport.ScrollUp(1) case "down", "j": - m.historyViewport.LineDown(1) + m.historyViewport.ScrollDown(1) case "pgup": - m.historyViewport.HalfViewUp() + m.historyViewport.HalfPageUp() case "pgdown": - m.historyViewport.HalfViewDown() + m.historyViewport.HalfPageDown() case "home", "g": m.historyViewport.GotoTop() case "end", "G": diff --git a/internal/tui/view_history.go b/internal/tui/view_history.go index 2b29c45..7811dae 100644 --- a/internal/tui/view_history.go +++ b/internal/tui/view_history.go @@ -160,11 +160,11 @@ func (m Model) viewHistoryPanel() string { b.WriteString(" " + subtleStyle.Render(strings.Repeat("─", divWidth)) + "\n") } - b.WriteString(fmt.Sprintf(" %-18s %-17s %-12s %s\n", + fmt.Fprintf(&b, " %-18s %-17s %-12s %s\n", subtleStyle.Render("TIME"), subtleStyle.Render("TRANSITION"), subtleStyle.Render("DURATION"), - subtleStyle.Render("REASON"))) + subtleStyle.Render("REASON")) if len(m.historyChanges) == 0 { b.WriteString("\n " + subtleStyle.Render("No state changes recorded") + "\n")