tui: allow chat scroll (up/down/pgup/pgdn) while the agent is busy
the up/down handlers required !i.busy before routing to scrollBy, which meant you couldn't scroll back through a long streaming reply while it was still arriving. dropped the busy check \u2014 chat scroll now works in both states, consistent with pgup/pgdn which never had the restriction.
- commit
- 728cf4e2b16217feb0c5a7ed5e9d1b4d8618a863
- author
- patriceckhart · · 2026-04-18 09:33 UTC
- parent
- c0f685f
- signature
- unsigned
- refs
- tag: v0.0.4
1 file · +6 -4
M internal/agent/modes/interactive.go +6 -4
| @@ -580,14 +580,16 @@ func (i *Interactive) handleKey(ctx context.Context, k tui.Key) (done bool) { | |||
| 580 | 580 | i.scrollBy(-i.chatPage()) | |
| 581 | 581 | return false | |
| 582 | 582 | case tui.KeyUp: | |
| 583 | - | // Wheel-up in alt screen sends Up arrows on most terminals. When the | |
| 584 | - | // editor is empty and we're not busy, use that for chat scroll-up. | |
| 585 | - | if i.ed.IsEmpty() && !i.busy { | |
| 583 | + | // Wheel-up in alt screen sends Up arrows on most terminals. | |
| 584 | + | // When the editor is empty we use up/down for chat scroll — | |
| 585 | + | // independently of whether the agent is busy, so users can | |
| 586 | + | // scroll back through long streaming replies while they run. | |
| 587 | + | if i.ed.IsEmpty() { | |
| 586 | 588 | i.scrollBy(+3) | |
| 587 | 589 | return false | |
| 588 | 590 | } | |
| 589 | 591 | case tui.KeyDown: | |
| 590 | - | if i.ed.IsEmpty() && !i.busy { | |
| 592 | + | if i.ed.IsEmpty() { | |
| 591 | 593 | if i.scrollOffset > 0 { | |
| 592 | 594 | i.scrollBy(-3) | |
| 593 | 595 | } | |
| @@ -580,14 +580,16 @@ func (i *Interactive) handleKey(ctx context.Context, k tui.Key) (done bool) { | |||||
| 580 | i.scrollBy(-i.chatPage()) | 580 | i.scrollBy(-i.chatPage()) | ||
| 581 | return false | 581 | return false | ||
| 582 | case tui.KeyUp: | 582 | case tui.KeyUp: | ||
| 583 | - | // Wheel-up in alt screen sends Up arrows on most terminals. When the | 583 | + | // Wheel-up in alt screen sends Up arrows on most terminals. |
| 584 | - | // editor is empty and we're not busy, use that for chat scroll-up. | 584 | + | // When the editor is empty we use up/down for chat scroll — |
| 585 | - | if i.ed.IsEmpty() && !i.busy { | 585 | + | // independently of whether the agent is busy, so users can |
| 586 | + | // scroll back through long streaming replies while they run. | |||
| 587 | + | if i.ed.IsEmpty() { | |||
| 586 | i.scrollBy(+3) | 588 | i.scrollBy(+3) | ||
| 587 | return false | 589 | return false | ||
| 588 | } | 590 | } | ||
| 589 | case tui.KeyDown: | 591 | case tui.KeyDown: | ||
| 590 | - | if i.ed.IsEmpty() && !i.busy { | 592 | + | if i.ed.IsEmpty() { |
| 591 | if i.scrollOffset > 0 { | 593 | if i.scrollOffset > 0 { | ||
| 592 | i.scrollBy(-3) | 594 | i.scrollBy(-3) | ||
| 593 | } | 595 | } | ||