Prevent unnecessary scrolling in the TUI entry details view #65

Closed
opened 2026-08-10 11:36:33 +00:00 by hugo · 1 comment
Owner

Problem

In the entry details view, moving between fields with j, k, arrow keys, or Tab can scroll the screen even when all details already fit within the available viewport. This makes the view visually unstable and moves content without a navigation need.

Required behavior

  • Keep the details viewport fixed while focus moves among fields that are already visible.
  • Scroll only when the newly focused field would otherwise be outside the usable viewport.
  • Use the smallest scroll adjustment needed to reveal an off-screen focused field.
  • Preserve stable behavior when moving forward and backward with j, k, arrows, Tab, and reverse Tab.
  • Recalculate visibility correctly after terminal resize, OTP presentation changes, and other responsive layout changes.
  • Keep focus and viewport rules in the TUI presentation layer without duplicating storage-domain decisions.

Acceptance criteria

  • Deterministic tests prove that focus navigation does not scroll when all details fit.
  • Tests cover minimal scrolling in overflowing views in both directions.
  • Resize and responsive-content tests keep the selected field visible without gratuitous viewport movement.
  • Small terminal layouts do not clip, panic, or lose the selected field.
  • All repository gates pass.
## Problem In the entry details view, moving between fields with j, k, arrow keys, or Tab can scroll the screen even when all details already fit within the available viewport. This makes the view visually unstable and moves content without a navigation need. ## Required behavior - Keep the details viewport fixed while focus moves among fields that are already visible. - Scroll only when the newly focused field would otherwise be outside the usable viewport. - Use the smallest scroll adjustment needed to reveal an off-screen focused field. - Preserve stable behavior when moving forward and backward with j, k, arrows, Tab, and reverse Tab. - Recalculate visibility correctly after terminal resize, OTP presentation changes, and other responsive layout changes. - Keep focus and viewport rules in the TUI presentation layer without duplicating storage-domain decisions. ## Acceptance criteria - Deterministic tests prove that focus navigation does not scroll when all details fit. - Tests cover minimal scrolling in overflowing views in both directions. - Resize and responsive-content tests keep the selected field visible without gratuitous viewport movement. - Small terminal layouts do not clip, panic, or lose the selected field. - All repository gates pass.
hugo added this to the 02 - Mutt-style terminal UI milestone 2026-08-10 11:36:33 +00:00
hugo added the bug label 2026-08-10 11:36:33 +00:00
Author
Owner

Implemented and pushed in e0ce213.

The TUI now keeps the entry-details viewport fixed while the selected field remains visible and moves it by only the rows needed when focus crosses an edge. j/k and Up/Down now follow the same field-navigation path as Tab/Shift-Tab. Rendering measures Ratatui wrapped-line heights, recalculates after resize and responsive OTP layout changes, preserves the selected field at the 40x8 minimum, and still permits Page Up/Down within a field taller than the viewport. The command reference documents the behavior.

Verification:

  • cargo fmt --all -- --check
  • RUSTFLAGS="-D warnings" cargo check --workspace --all-targets
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace

The TUI suite passes all 89 tests, including deterministic fit, overflow in both directions, resize, wrapped fields, oversized fields, compact OTP, and minimum-layout regressions.

Implemented and pushed in e0ce213. The TUI now keeps the entry-details viewport fixed while the selected field remains visible and moves it by only the rows needed when focus crosses an edge. j/k and Up/Down now follow the same field-navigation path as Tab/Shift-Tab. Rendering measures Ratatui wrapped-line heights, recalculates after resize and responsive OTP layout changes, preserves the selected field at the 40x8 minimum, and still permits Page Up/Down within a field taller than the viewport. The command reference documents the behavior. Verification: - cargo fmt --all -- --check - RUSTFLAGS="-D warnings" cargo check --workspace --all-targets - cargo clippy --workspace --all-targets -- -D warnings - cargo test --workspace The TUI suite passes all 89 tests, including deterministic fit, overflow in both directions, resize, wrapped fields, oversized fields, compact OTP, and minimum-layout regressions.
hugo closed this issue 2026-08-10 12:48:31 +00:00
Sign in to join this conversation.