Skip to content

Commit 5ae16a9

Browse files
committed
fix: scroll gap mismatch, error body styling, and scroll amounts
- Fix contentHeight/renderContent gap mismatch causing janky scrolling - Keyboard arrows scroll 1 line, mouse wheel scrolls 5 lines - Always show message list border (invisible when unfocused, cyan when focused) - Add right padding to match left border width - Remove panel background from error and running tool states - Only success results get the grey container
1 parent dcc1664 commit 5ae16a9

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

‎internal/app/chat/messagelist/messagelist.go‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ func (m *Model) Update(msg tea.Msg) tea.Cmd {
7777
case tea.KeyPressMsg:
7878
if m.focused {
7979
if key.Matches(msg, scrollUpKey) {
80-
m.scrollUp(3)
80+
m.scrollUp(1)
8181
m.userScrolled = true
8282
} else if key.Matches(msg, scrollDownKey) {
83-
m.scrollDown(3)
83+
m.scrollDown(1)
8484
if m.isAtBottom() {
8585
m.userScrolled = false
8686
}
@@ -90,10 +90,10 @@ func (m *Model) Update(msg tea.Msg) tea.Cmd {
9090
case tea.MouseWheelMsg:
9191
switch msg.Button {
9292
case tea.MouseWheelUp:
93-
m.scrollUp(3)
93+
m.scrollUp(5)
9494
m.userScrolled = true
9595
case tea.MouseWheelDown:
96-
m.scrollDown(3)
96+
m.scrollDown(5)
9797
// If user scrolled to bottom, re-enable auto-scroll
9898
if m.isAtBottom() {
9999
m.userScrolled = false
@@ -206,6 +206,7 @@ func (m *Model) View() string {
206206
BorderLeft(true).
207207
BorderStyle(lipgloss.ThickBorder()).
208208
BorderForeground(borderColor).
209+
PaddingRight(focusBorderWidth).
209210
Render(output)
210211
}
211212

@@ -215,13 +216,14 @@ func (m *Model) renderContent() string {
215216
return ""
216217
}
217218

219+
gap := strings.Repeat("\n", roundGap+1) // roundGap blank lines = roundGap+1 newlines
220+
218221
var parts []string
219222
for _, r := range m.rounds {
220223
parts = append(parts, r.View())
221224
}
222225

223-
// Join with gaps between rounds
224-
return strings.Join(parts, "\n\n")
226+
return strings.Join(parts, gap)
225227
}
226228

227229
// emptyView renders an empty view padded to height.
@@ -305,9 +307,9 @@ func (m *Model) SetFocused(focused bool) {
305307
}
306308

307309
// contentWidth returns the width available for round content.
308-
// Border is always present (invisible when unfocused) so always subtract.
310+
// Border + right padding are always present so always subtract.
309311
func (m *Model) contentWidth() int {
310-
return m.width - focusBorderWidth
312+
return m.width - focusBorderWidth - focusBorderWidth
311313
}
312314

313315
// updateRoundWidths sets the width on all rounds.

‎internal/app/chat/messagelist/round/turn/assistant/blocks/tools/tool.go‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ func (m *Model) View() string {
159159
if status := m.child.Status(); status != "" {
160160
header = fmt.Sprintf("%s %s %s", icon, nameStyle.Render(m.child.Name()), mutedStyle.Render("· "+status))
161161
}
162-
body := m.bodyStyle().Render(m.thinking.View())
162+
body := lipgloss.NewStyle().
163+
PaddingLeft(bodyPaddingLeft).
164+
Render(m.thinking.View())
163165
return header + "\n\n" + body
164166

165167
case StatusSuccess:
@@ -192,7 +194,9 @@ func (m *Model) View() string {
192194
Padding(0, 1).
193195
Render("ERROR")
194196
errMsg := m.child.Err().Error()
195-
body := m.bodyStyle().Render(errTag + " " + mutedStyle.Render(errMsg))
197+
body := lipgloss.NewStyle().
198+
PaddingLeft(bodyPaddingLeft).
199+
Render(errTag + " " + mutedStyle.Render(errMsg))
196200
return header + "\n\n" + body
197201
}
198202

0 commit comments

Comments
 (0)