Repository navigation
feat(tui): add viewport scrolling for dashboard and detail views - #8169
Merged
Merged
Conversation
## The Issue
The TUI dashboard project list and detail view had no scrolling support.
When there were more projects or content than fit on the terminal screen,
the title bar would disappear and content would be cut off. Long URLs,
add-on lists, and service lists were also truncated at the terminal edge
without any indication. Additionally, the viewport would reset to top every
5 seconds during auto-refresh, making it difficult to browse the list.
## How This PR Solves The Issue
Used the `viewport` component from bubbles/viewport instead of implementing
custom scroll tracking:
- Added `dashboardViewport` and `detailViewport` fields using `viewport.Model`
- Created `updateDashboardViewport()` helper that rebuilds dashboard content
and adjusts scroll position to keep the cursor visible
- Fixed viewport reset on refresh by removing `GotoTop()` call in projectsLoadedMsg handler
- Split view rendering into content builders (`buildDashboardContent()`,
`buildDetailContent()`) and view renderers that wrap the viewport
- Added PageUp/PageDown keybindings for faster navigation
- Viewport initialization in WindowSizeMsg handler with proper sizing
- Added `ansi.Wrap()` for proper message wrapping (errors, confirmations) to multiple lines
- Reorganized dashboard layout with consistent divider placement and spacing
- Dynamic key references in status messages (e.g., uses `m.keys.Start.Help().Key`)
- Add-ons now wrap to multiple lines with proper indentation instead of truncating
- Services displayed as comma-separated list with wrapping only at service boundaries
The viewport component automatically handles scroll indicators, boundary
checking, and smooth scrolling. Title bar and footer remain visible at all
times. The scroll position is preserved during auto-refresh.
## Manual Testing Instructions
**List scrolling** - create enough projects to overflow the terminal:
```bash
for name in proj-{01..30}; do
mkdir -p ~/tmp/$name && cd ~/tmp/$name
ddev config --auto --project-name=$name
done
ddev tui
```
Press up/down or pgup/pgdown - the list scrolls and scroll indicators appear.
The title bar and footer must remain visible at all times. Wait 5+ seconds
and verify the scroll position doesn't jump to top during auto-refresh.
**Detail view scrolling** - create a project with many URLs, add-ons, and services:
```bash
mkdir -p ~/tmp/test-detail && cd ~/tmp/test-detail
ddev config --auto \
--additional-hostnames=one,two,three,four,five,six,seven,eight,nine,ten
ddev add-on get ddev/ddev-redis
ddev add-on get ddev/ddev-memcached
ddev start
ddev tui
```
Open the project detail (Enter). Press up/down or pgup/pgdown - content scrolls
with indicators, title stays visible. Add-ons wrap across multiple lines with
indentation. Services display as comma-separated list with commas at line breaks.
**Message wrapping** - trigger a long error message to verify it wraps properly
instead of being truncated (e.g., docker connection error with long host).
**Filter + scroll** - type `/` to filter, then use up/down to navigate the
filtered list. Enter opens the detail view for the selected project.
## Automated Testing Overview
Updated all existing tests to initialize viewports properly by sending
WindowSizeMsg before loading data. Tests verify:
- Viewport initialization
- Scroll position management
- Content building with proper wrapping
- Filter mode with scrolling
## Release/Deployment Notes
Vendored new dependencies:
- `github.com/charmbracelet/bubbles/viewport`
- `github.com/charmbracelet/x/ansi`
Users can now navigate large project lists and detailed views without losing
visibility of the title or footer. PageUp/PageDown provide faster navigation.
Scroll position is preserved during auto-refresh. Long messages, add-ons, and
services wrap properly instead of being truncated.
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
|
Download the artifacts for this pull request:
See Testing a PR. |
Member
Author
Member
Author
rfay
approved these changes
Feb 22, 2026
rfay
left a comment
Member
There was a problem hiding this comment.
Pretty amazing. Works great. Hard to believe that scrolling could even be a possilibity.
Member
|
We can probably deploy on a phone now. |
Member
|
The site selector color is definitely better. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




The Issue
The TUI dashboard project list and detail view had no scrolling support. When there were more projects or content than fit on the terminal screen, the title bar would disappear and content would be cut off. Long URLs, add-on lists, and service lists were also truncated at the terminal edge without any indication.
How This PR Solves The Issue
Used the
viewportcomponent from bubbles/viewport instead of implementing custom scroll tracking:dashboardViewportanddetailViewportfields usingviewport.ModelupdateDashboardViewport()helper that rebuilds dashboard content and adjusts scroll position to keep the cursor visibleGotoTop()call in projectsLoadedMsg handlerbuildDashboardContent(),buildDetailContent()) and view renderers that wrap the viewportansi.Wrap()for proper message wrapping (errors, confirmations) to multiple linesm.keys.Start.Help().Key)The viewport component automatically handles scroll indicators, boundary checking, and smooth scrolling. Title bar and footer remain visible at all times. The scroll position is preserved during auto-refresh.
This PR replaces cyan color with blue for better readability on white background.
Manual Testing Instructions
List scrolling - create enough projects to overflow the terminal:
Press up/down or pgup/pgdown - the list scrolls and scroll indicators appear. The title bar and footer must remain visible at all times. Wait 5+ seconds and verify the scroll position doesn't jump to top during auto-refresh.
Detail view scrolling - create a project with many URLs, add-ons, and services:
Open the project detail (Enter). Press up/down or pgup/pgdown - content scrolls with indicators, title stays visible. Add-ons wrap across multiple lines with indentation. Services display as comma-separated list with commas at line breaks.
Message wrapping - trigger a long error message to verify it wraps properly instead of being truncated (e.g., docker connection error with long host).
Automated Testing Overview
Updated all existing tests to initialize viewports properly by sending WindowSizeMsg before loading data. Tests verify:
Release/Deployment Notes
Vendored new dependencies:
github.com/charmbracelet/bubbles/viewportgithub.com/charmbracelet/x/ansiUsers can now navigate large project lists and detailed views without losing visibility of the title or footer. PageUp/PageDown provide faster navigation. Scroll position is preserved during auto-refresh. Long messages, add-ons, and services wrap properly instead of being truncated.