Skip to content

Step the preview with ↑ and ↓, like Quick Look on macOS - #21

Closed
kevinpardo wants to merge 2 commits into
omacom:mainfrom
kevinpardo:preview-up-down
Closed

kevinpardo wants to merge 2 commits into
omacom:mainfrom
kevinpardo:preview-up-down

Conversation

@kevinpardo

@kevinpardo kevinpardo commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What changes

This brings the preview closer to how Quick Look behaves on macOS. There, with Quick Look open, the arrow keys keep driving the Finder: in list or column view ↑ and ↓ move the selection to the file above or below, in icon view all four arrows move through the grid, and Quick Look follows to show whatever is now selected. You can flip through a folder of photos or documents without ever closing the preview. Folio's preview (Space) already follows the selection, and ← and → step through the folder, so ↑ and ↓ were the missing piece.

Before this change, ↑ and ↓ in the preview only scrolled. On a picture, a video, audio or a folder there's nothing to scroll, so they did nothing. That's most noticeable in the list and column views, where files sit one above the other and ↑ and ↓ are the keys you use to move through them.

Now ↑ and ↓ still scroll whatever is taller than the window: a long text, a PDF or a zoomed picture. Anything that fits moves to the item above or below, following the folder view's layout. That's the row above or below in the list and columns, and the tile above or below in the grid. ← and → are unchanged.

Only the Folio window knows its layout, so the preview writes step -1 or step 1 on the same stdout channel it already uses. Folio moves its selection, and the existing selection-following sends the new item back to the preview. A preview running on its own (folio preview <file>) falls back to the previous and next file. The help overlay now lists ↑ ↓ next to ← →.

Verification

  • tests/folio_tests: 74 passed, including a new previewerStepsByRowOnItsOwn for the standalone fallback.
  • On Omarchy (aarch64, Hyprland), rebased on current main, with a folder of 8 images, opening the preview with Space, then pressing:
    • Columns (Ctrl+3): ↓ ↓ ↓ ↑ → ← showed images 2, 3, 4, 3, 4, 3. The selection in the column follows.
    • Grid (Ctrl+1, 3 tiles per row): ↓ ↓ ↑ → showed images 4, 7, 4, 5.
    • List (Ctrl+2): ↓ ↑ ↑ showed images 2, 1, 1 (stops at the top).
  • Not checked: scrolling a long text or a PDF with ↑ ↓ after the change. The code path for those is the same scroll() call as before, taken when the content is taller than the window.

Screenshots

Column view, a folder of 8 images, preview open with Space, then ↓ ↓ ↓ ↑.

Before: ↓ and ↑ do nothing on a picture.

Before: the preview stays on image 1 while ↓ ↓ ↓ ↑ are pressed

After: ↓ and ↑ move to the file below and above, and the selection in the column follows.

After: ↓ ↓ ↓ ↑ show images 2, 3, 4 and 3, and the selection in the column follows

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ufqf7cLLeC113cXjB33N3R

@kevinpardo
kevinpardo marked this pull request as ready for review November 11, 2026 08:45
@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with a remaining non-blocking arrow-order issue when Folio takes over a second to reply.

Findings

  1. P2 Fast arrows lose movement ▶

Summary

Adds ↑ and ↓ navigation that follows the folder's list, column, or grid layout.

  • Up and Down scroll tall previews or move to the item above or below.

Diagram

sequenceDiagram
    participant Preview as Preview window
    participant Backend as Folio backend
    participant Pane as Folder pane
    Preview->>Backend: step direction
    Backend->>Pane: stepRequested(direction)
    Pane->>Pane: Move selection
    Pane->>Backend: followSelection(path)
    Backend-->>Preview: New path, when selection changed
    Backend-->>Preview: stepped
    Preview->>Preview: Take queued arrows
Loading

Reviews (3) · Last reviewed commit: "Hold the preview's arrows until Folio ha..." · Reviewed by Greptile

Comment thread src/PreviewWindow.qml Resolved
In the preview, ↑ and ↓ only scrolled, so on a picture, a video or a
folder they did nothing, and in the list and column views, where files sit
one above the other, there was no way to step to the next one with the
keys that move through them in the folder.

Now ↑ and ↓ still scroll what's taller than the window (a long text, a
zoomed picture, a PDF), and anything that fits moves to the item above or
below as the folder view lays them out: the row above or below in the list
and columns, the tile above or below in the grid. The preview asks Folio
with a "step -1" or "step 1" line, since only the window knows its layout;
Folio moves its selection and sends the new item back as it already does.
A preview running on its own falls back to the previous and next file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ufqf7cLLeC113cXjB33N3R
Comment thread src/previewer.cpp Resolved
…xt loads

After ↑ or ↓ the preview asked Folio for the row above or below, but an arrow
pressed before the answer was taken from the old item: ↓ then → in a grid
undid the ↓. Folio now sends the new item at once and then "stepped", and the
preview keeps the arrows that came meanwhile until it does (a second at most,
if no answer comes).

A text still being read looked short, so ↑ and ↓ stepped past a long file on
a slow mount. They do nothing until the text is in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ufqf7btMhVDAcTs2d8sLqB
@dhh

dhh commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Thank you, @kevinpardo, this is a lovely touch. I rebased your two commits onto today's main (the preview's shortcuts sheet is now in groups, so ↑ ↓ now sit beside ← → there) and opened them as #174, with your authorship kept, since I couldn't push to your branch. Closing this one in favor of that.

@dhh dhh closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants