(1b78a24) Scroll the tui detail view on pgup and pgdn, and bump to 0.7.1
The detail view had no scrolling at all: no offset on Board, nothing passed to Paragraph::scroll, so anything past the height of the overlay was unreachable. Every ticket in this repo is longer than that. The footer read "↑↓ scroll" while up and down moved the selection, so it named a key that did nothing and sent the reader looking for their own mistake. The scroll goes on pgup and pgdn rather than taking up and down. Up and down stay on the selection with the modal open, so a whole column can be read without closing it and the modal follows the selection. That is worth more than the two keys. The offset is clamped against the wrapped line count from Paragraph::line_count, which is why ratatui now carries the unstable-rendered-line-info feature. The paragraph wraps on words, so a clamp on the raw lines would stop short of the end or run past it into blank space, and counting the wrapping by hand would only agree with the widget until one of the two changed. The clamp runs on the keypress and again in the draw, since the terminal can be resized between them and a tick can shorten the ticket under a reader who is already at the end. The offset resets when the selection moves and when the modal is closed, so a ticket opens at its top. It deliberately does not reset on a tick: an edit elsewhere in the tree must not throw the reader back to the top of what they are reading. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
77bf2d9e2a
commit
c1137f29cf
@@ -141,6 +141,9 @@ fn run_tui(start: &std::path::Path) -> Result<()> {
|
||||
board.tick()?;
|
||||
terminal.draw(|frame| tui::draw(frame, &board))?;
|
||||
|
||||
// Taken after the draw, so a scroll measures the overlay that is on screen.
|
||||
let screen = terminal.size()?;
|
||||
|
||||
// Bounded, so the tick still runs when nobody is typing.
|
||||
if !event::poll(tui::POLL)? {
|
||||
continue;
|
||||
@@ -166,8 +169,13 @@ fn run_tui(start: &std::path::Path) -> Result<()> {
|
||||
KeyCode::Enter | KeyCode::Char(' ') => board.toggle_detail(),
|
||||
KeyCode::Left | KeyCode::Char('h') => board.select_column(-1),
|
||||
KeyCode::Right | KeyCode::Char('l') => board.select_column(1),
|
||||
// Up and down stay on the selection, open detail view or not, so a
|
||||
// column can be read through without closing the modal. Scrolling the
|
||||
// open ticket is a page at a time.
|
||||
KeyCode::Up | KeyCode::Char('k') => board.select_card(-1),
|
||||
KeyCode::Down | KeyCode::Char('j') => board.select_card(1),
|
||||
KeyCode::PageUp => board.scroll_detail(-1, screen),
|
||||
KeyCode::PageDown => board.scroll_detail(1, screen),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user