Skip to content

Commit b1baabd

Browse files
committed
Fix mouse interaction artifacts and scroll speed
- Change scroll wheel to move 1 item at a time (was 3) for precise navigation - Remove early returns from mouse handlers to ensure full Update flow runs, fixing visual artifacts where old/new selections were both visible - Remove Width() wrapper from listviewport.View() to prevent zone marker artifacts (per bubblezone docs, Width/MaxWidth can corrupt zone markers)
1 parent dcabc21 commit b1baabd

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

internal/tui/components/listviewport/listviewport.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"time"
55

66
"github.com/charmbracelet/bubbles/viewport"
7-
"github.com/charmbracelet/lipgloss"
87

98
"github.com/dlvhdr/gh-dash/v4/internal/tui/constants"
109
"github.com/dlvhdr/gh-dash/v4/internal/tui/context"
@@ -162,13 +161,10 @@ func (m *Model) SetDimensions(dimensions constants.Dimensions) {
162161
}
163162

164163
func (m *Model) View() string {
165-
viewport := m.viewport.View()
166-
// Note: Avoid using MaxWidth() on content containing zone markers as it can
167-
// truncate them and cause visual artifacts. The viewport already constrains
168-
// content to its width.
169-
return lipgloss.NewStyle().
170-
Width(m.viewport.Width).
171-
Render(viewport)
164+
// Return viewport content directly without additional Width/MaxWidth styling.
165+
// The viewport already constrains content to its width, and applying
166+
// Width/MaxWidth to content containing zone markers can cause visual artifacts.
167+
return m.viewport.View()
172168
}
173169

174170
func (m *Model) UpdateProgramContext(ctx *context.ProgramContext) {

internal/tui/ui.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -667,20 +667,15 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
667667
if section != nil {
668668
if msg.Button == tea.MouseButtonWheelUp {
669669
section.PrevRow()
670-
section.PrevRow()
671-
section.PrevRow()
672670
} else {
673671
prevRow := section.CurrRow()
674-
section.NextRow()
675-
section.NextRow()
676672
nextRow := section.NextRow()
677673
// Fetch more if we're near the bottom
678674
if prevRow != nextRow && nextRow >= section.NumRows()-3 && m.ctx.View != config.RepoView {
679675
cmds = append(cmds, section.FetchNextPageSectionRows()...)
680676
}
681677
}
682-
cmds = append(cmds, m.onViewedRowChanged())
683-
return m, tea.Batch(cmds...)
678+
cmd = m.onViewedRowChanged()
684679
}
685680
}
686681
}
@@ -706,9 +701,8 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
706701
currRow := section.CurrRow()
707702
if clickedRow != currRow {
708703
section.SetCurrRow(clickedRow)
709-
cmds = append(cmds, m.onViewedRowChanged())
704+
cmd = m.onViewedRowChanged()
710705
}
711-
return m, tea.Batch(cmds...)
712706
}
713707
}
714708
}

0 commit comments

Comments
 (0)