Repository navigation
Keep keyboard selection visible in folder views - #79
Conversation
- Keep the current item visible after keyboard navigation. - Cover grid, list, and columns with real-view input tests.
[Medium impact] The PR appears safe to merge, with a non-blocking request to restore the removed test coverage. Findings
SummaryThe PR keeps keyboard-selected items visible across all three folder views.
Reviews (4) · Last reviewed commit: "Trim the keyboard scrolling test to the ..." · Reviewed by Greptile |
|
Independently verified this fix for the keyboard auto-scrolling bug in #98, also encountered with Omarchy's current Folio 0.4.0-2 package. I applied this PR's regression tests and the same two-line Selecting.qml change to main at 61b7e20, using Qt 6.12.0 on Linux/amd64. Selecting.qml is unchanged between v0.4.0 and that main revision. Before the fix, folderKeyboardScrolls fails in all three views (grid, list, columns) because the selected item leaves the viewport. With the fix, all three pass, including Down/Up, Shift+Down selection, clicking, and wheel scrolling. This verification covers automatic scrolling to the keyboard-selected item; no additional mouse/touchpad scrolling change was needed. The build and full test suite passed: 199 passed, 0 failed, 0 skipped, with LC_ALL=en_US.UTF-8 and dbus-run-session -- bin/test -V (offscreen Qt). Two additional regression cases worth covering, beyond the existing tests:
These are suggestions for additional coverage; the reported bug is already reproduced and covered by this PR's current tests. |
- Cover arrow navigation after wheel scrolling the cursor offscreen. - Cover Down after clearing a cursor in a scrolled view. - Verify cursor restoration reveals the item and preserves selection.
|
Thanks @sebishogun for independently verifying the fix and suggesting the additional cases. Added both to the real-view tests in 2cbda71. For grid, list, and columns, the tests now wheel-scroll the selected item completely above the viewport, check that selection is preserved, then press Down and verify the new selection is visible. They also scroll to the end, clear the selection and cursor through the same methods used by an empty-space click, then press Down and verify that item 0 is selected and visible. Added a direct All three view cases pass offscreen, and |
|
Reviewed at 2cbda71. The bug is real, this fixes it, and I found nothing to change. What was checked. Everything ran on a disposable VM built from the Omarchy ISO, with a real Hyprland session:
The fix uses the views' own Second opinion. Codex Medium and muse-wonder via pi (thinking high) each reviewed the diff and the code around it. Neither found anything blocking, and both agreed with the points above. They can read this session's notes, so that agreement is not guaranteed to be independent. Codex noted two small test gaps, neither of which hides this bug. The click step checks the selection count but not which item was clicked. The restore step calls Related. I've linked #98, which reports this bug and proposes the same two lines, so it closes when this merges. #18 and #55 by @thisisgm contain the same change to What it waits on. The maintainer. folio's Test workflow hasn't run on this pull request yet, because GitHub holds workflows from forks until a maintainer approves them. After that, it is the maintainer's decision. |
The test now presses Down past the fold in each view and checks after every press that the cursor stays in sight, which is what fails without the fix, then that the cursor really went thirty items down, so arrows that stopped moving it can't pass for arrows that scroll. The Up, Shift, click, wheel, clear-cursor and restore steps exercised paths that already scrolled, or never scroll, on main, so they passed with or without it. Visibility is checked from the cursor's item in window coordinates, so the columns view needs no reach into its inner list. The guard before positionViewAtIndex goes too: the view already ignores an index of -1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
The maintainer asked for the simplest version of this fix that still does the job, so I pushed 4d0cd16 to the branch. The fix is the same, and the test is cut down to the part that catches the bug. What changed
What was checked
Second opinion. Codex Medium and muse-wonder via pi (thinking high) reviewed the trim in two rounds.
@mitechell, the second paragraph of the description still lists Up/Down, Shift+Down, click and wheel coverage. The test now covers Down past the fold in each view; you may want to update that paragraph. What it waits on. The maintainer. GitHub holds the Test workflow at 4d0cd16 for approval, because the commit was pushed to a fork. It passed at cfbb91b, which has the same fix. |
| // Thirty presses take the cursor well past the fold in every view. | ||
| for (int i = 0; i < 30; ++i) { | ||
| QTest::keyClick(window, Qt::Key_Down); | ||
| QTRY_VERIFY(cursorInView()); | ||
| } | ||
| QVERIFY(root->property("cursor").toInt() >= 29); |
There was a problem hiding this comment.
Broader input checks were removed
The shortened folderKeyboardScrolls test drops checks for Up, Shift+Down, clicks, wheel scrolling, and the selected items. It now checks only Down and cursor visibility. This is non-blocking, but it leaves broken range selection and unwanted scrolling less likely to be caught. Restore the removed checks alongside the visibility checks.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
The trim was deliberate: the maintainer asked for the smallest test that guards this fix. The removed steps (Up, Shift+Down, a click, wheel scrolling, clearing the cursor and the selected items) all passed on main without the fix, so they did not guard this change; they were regression coverage for other behaviour. The kept test fails in grid, list and columns with Selecting.qml reverted to main, and its index check fails if the first Down works but later ones are swallowed. If broader keyboard and selection coverage is wanted, it belongs in its own test rather than this one. Checked by Claude Opus 5.5 with a second opinion from Codex Medium and muse-wonder High.
There was a problem hiding this comment.
You’re right. I treated the omitted cases as a coverage loss without accounting for whether they fail without this fix. Since they pass on main, they don’t guard this regression; the retained test checks both visibility after each Down press and continued cursor advancement. I withdraw the recommendation to restore those checks. Broader keyboard and selection coverage belongs in a separate test.
The folio and folio-scroll workloads and the soak's Folio workloads run one commit of Folio instead of Omarchy's package: 2e2a71633b76 (omacom/folio#79, after 0.5.0), which scrolls the list to the cursor on Down. Before it the cursor walked off the bottom and folio-scroll measured the cursor and the details pane, not scrolling, so its numbers from before do not compare. scripts/machines/folio.sh builds the commit on the machines into /opt/folio/<commit>/, next to Omarchy's package, which it leaves alone; the workloads are skipped where it is not built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>







Keeps keyboard-selected items visible in grid, list, and columns using
ListView.Contain. Preserves click positioning and range selection.Adds a regression test for Down-arrow navigation in grid, list, and columns. Each view starts with no cursor and receives 30 Down presses. The test checks that the current item stays visible after every press and that the cursor advances past the initially visible items. All three views fail without the fix and pass with it.
Validation: bin/build passed; LC_ALL=en_US.UTF-8 bin/test passed 197 tests. Reporter confirmed the desktop fix. Two pre-existing sorting failures under C.UTF-8 pass under en_US.UTF-8.
Fixes #98