fix(tui): resolve staticcheck lint errors in history view
CI / test (pull_request) Successful in 2m39s
CI / lint (pull_request) Successful in 51s
CI / vulncheck (pull_request) Successful in 51s

- Replace deprecated LineUp/LineDown/HalfViewUp/HalfViewDown with
  ScrollUp/ScrollDown/HalfPageUp/HalfPageDown
- Use tagged switch for mouse button dispatch
- Use fmt.Fprintf instead of WriteString(Sprintf)
This commit is contained in:
2026-06-03 20:22:41 -04:00
parent bc661f5207
commit 1d1f5d0ee4
2 changed files with 9 additions and 8 deletions
+7 -6
View File
@@ -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":
+2 -2
View File
@@ -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")