Viewer: the model list keeps the selected row on screen without jumping #106

Manually merged
github merged 1 commit from gh-pr/106/head into gh-pr/106/base 2026-11-26 20:10:15 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-24 02:45 UTC · original
holdmysocks:claude/picker-scroll → master · +24 −2 · 1 files · 1 commits · merged 2026-11-24 02:54 UTC

Reported by the user: after scrolling the model list and selecting an item, the list moves and has to be scrolled back; the selected item should stay on screen, with the arrow keys too.

What

  • Arrow keys. Stepping with Up / Down set the scroll offset on every step so that the row sat 120 px from the top, which moved the whole list each time. The list now scrolls only as far as it takes to keep the row on screen (one spare row at the edge); a row already in view leaves the list where it is. It uses the list's offset and height from the previous frame.
  • After a click. A clicked row kept the keyboard focus. egui moves focus between widgets with the arrow keys and scrolls to the focused widget, so after a click the arrow keys both stepped the cursor and dragged the view to wherever focus went. The row now gives up focus when clicked.
  • The list's scroll area has a fixed id.

Checked

  • Builds; cargo test -p sixng-gui: 12 passed.
  • Not tried by hand: this session cannot drive the viewer's mouse and keyboard. The causes above are read from the code; the user will confirm in the running viewer.

Not done

  • Arrow keys are ignored while a model is loading (unchanged), so fast repeated presses skip.
**@⁠holdmysocks** on GitHub · 2026-11-24 02:45 UTC · [original](https://github.com/holdmysocks/SixNG/pull/106) `holdmysocks:claude/picker-scroll` → `master` · +24 −2 · 1 files · 1 commits · merged 2026-11-24 02:54 UTC Reported by the user: after scrolling the model list and selecting an item, the list moves and has to be scrolled back; the selected item should stay on screen, with the arrow keys too. ## What - **Arrow keys.** Stepping with Up / Down set the scroll offset on every step so that the row sat 120 px from the top, which moved the whole list each time. The list now scrolls only as far as it takes to keep the row on screen (one spare row at the edge); a row already in view leaves the list where it is. It uses the list's offset and height from the previous frame. - **After a click.** A clicked row kept the keyboard focus. egui moves focus between widgets with the arrow keys and scrolls to the focused widget, so after a click the arrow keys both stepped the cursor and dragged the view to wherever focus went. The row now gives up focus when clicked. - The list's scroll area has a fixed id. ## Checked - Builds; `cargo test -p sixng-gui`: 12 passed. - **Not tried by hand**: this session cannot drive the viewer's mouse and keyboard. The causes above are read from the code; the user will confirm in the running viewer. ## Not done - Arrow keys are ignored while a model is loading (unchanged), so fast repeated presses skip.
- Stepping with Up / Down scrolled the list every time so that the row
  sat 120 px from the top. It now scrolls only as far as it takes to keep
  the row on screen, with one row to spare at the edge.
- A clicked row kept the keyboard focus. egui moves focus with the arrow
  keys and scrolls to the focused widget, so the list jumped about while
  Up / Down also stepped the cursor. The row gives up focus on click.
- The list has a fixed id.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:10:15 +00:00
github manually merged commit f74276f16f into gh-pr/106/base 2026-11-26 20:10:15 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.