Skip to content

Draw hierarchy lines in the list's tree - #222

Open
rustytensor wants to merge 2 commits into
omacom:mainfrom
rustytensor:upstream-tree-lines
Open

rustytensor wants to merge 2 commits into
omacom:mainfrom
rustytensor:upstream-tree-lines

Conversation

@rustytensor

@rustytensor rustytensor commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

The list view opens folders in place as a tree, and today only the indent shows what is inside what. This adds hierarchy lines: a guide runs down from each open folder and turns into each of its items with a small curve. They are off by default, so nothing changes until you pick a style.

What you'd notice

  • A new button in the top bar, beside the view button, shown only in the list view. It opens a menu with four choices: No lines, Quiet, Git graph and Trace.
  • L steps through the same four choices and Shift+L steps back, the way S and Shift+S step the sort order. The keys only work in the list view.
  • Quiet draws thin, faint lines in the text color.
  • Git graph draws each level in its own color (four colors, then they repeat), with a dot where a guide starts and a dot at each folder inside an open folder.
  • Trace looks like Quiet, and also draws the way from the top down to the item the cursor is on, in the accent color.
  • The choice is kept when you restart Folio, and both panes of a split follow it.
  • The lines follow the zoom, scroll with the rows, and are mirrored right to left.
  • Columns and grid have no lines, and the button is hidden there.
Dark Light
Quiet Quiet, dark Quiet, light
Git graph Git graph, dark Git graph, light
Trace Trace, dark Trace, light

What changed

+390 −3, in two commits. Most of it is one new file.

  • A new TreeLines.qml (262 lines) draws the lines. It sits in the list's content, above the rows' fills, and takes no clicks. It works the lines out from the rows' depths, not from the row items, because a guide crosses rows the list has not made.
  • FolderModel gets outline(), which gives every row's depth and whether it is a folder in one call. get() builds a whole map for one row, which is too much to do for every row of a long list. outline() has one test.
  • Main.qml keeps the choice as lineStyle in its Settings, and holds the list of styles that the menu and the keys share. A stored value this build does not know draws no lines and is left as it is.
  • PathBar.qml has the button and its menu, Glyph.qml the button's glyph, and FolderPane.qml the two keys. The menu is made the first time it is opened, like the sort menu, and the keys work without it.
  • With no lines chosen, the rows are never read. With a style on, they are read once, in one outline() call, each time rows are added, removed or replaced.
  • Qt's software renderer loses a layer's contents above scale 1, so there the lines are drawn without one. On a GPU nothing is different.
  • The keys are in the ? overlay and the README. The new strings are only in en.json.
  • Four object names (treeLines, linesButton, linesMenu and lines-<style>) are there for the gates below. Nothing else in the code exists for them.
  • The first commit is a one-line fix in FolderPane.qml that the lines need. The Ctrl+scroll handler has parent: view.item, which is null until the loader has made its view. With no parent, the garbage collector can take the handler, and Ctrl+scroll then does nothing. TreeLines.qml allocates enough while it loads to make that happen often enough that listRowsFollowTheSizeStep failed with it. The handler now stays on the loader until there is a view.

Tested

One new test covers outline(). Everything else is checked by gates, as in #114: 30 checks with fixed expected results, kept outside the PR. They are on the tree-lines-gates branch of my fork, and its README lists what each one expects.

The gates open Folio's real window and read where the lines are. They cover each style, opening and closing folders, the menu and that it is only made when first opened, the keys, zoom from 0.75 to 2 (the lines must meet the real arrows and pictures), display scales 1.5 and 2, right to left, a settings file with an unknown style, 2,000 rows eight levels deep, a folder opened just before the folder is re-read, a file arriving in an open empty folder, and that "No lines" draws the same pixels as main. In a folder of 10,000 items with one folder open, adding a file calls outline() once and get() never, and may cost at most 20 ms more with the lines than without. In my last run it was 3 to 6 ms more. The numbers move by more than that on a busy machine.

All 30 pass on Omarchy, and bin/test gives main's result plus the new test: 290 passed, 1 skipped.

To run them, in a checkout of this branch that also has a local main:

git clone -b tree-lines-gates https://github.com/rustytensor/folio ../folio-tree-gates
../folio-tree-gates/gates.sh

It needs cmake, qmake6 and python3. It takes a few minutes, because it rebuilds Folio from clean in the checkout's build/ folder and runs the whole test suite.

@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues remain.

Summary

Adds optional hierarchy lines to the list view, with Quiet, Git graph and Trace styles.

  • The list draws hierarchy lines for open folders.
  • List users can choose and save a hierarchy-line style.
  • Ctrl+scroll keeps resizing rows and tiles during view changes.

Reviews (2) · Last reviewed commit: "Draw hierarchy lines in the list's tree" · Reviewed by Greptile

Comment thread src/TreeLines.qml Resolved
The handler's parent was view.item, which is null until the loader has
made its view. With no parent, the garbage collector can take the
handler, and Ctrl+scroll then no longer steps the size. It now stays on
the loader until there is a view.
The list opens folders in place, and only the indent showed what is
inside what. A guide now runs down from each open folder and turns into
each of its items. There are three styles (Quiet, Git graph, Trace),
picked from a new button beside the view button or stepped through with
L and Shift+L. They are off by default.

TreeLines.qml works the lines out from the rows' depths, which
FolderModel::outline() gives in one call. With no lines chosen the rows
are never read. The menu is made the first time it is opened.
@rustytensor

Copy link
Copy Markdown
Contributor Author

The red check here is thumbnailsCancelRunningHelpersAndAvoidFailureMarker, which this PR does not touch. It is a race in the test itself, and it shows on CI runners with four cores. I have sent a fix for the test as #224. Once that is in, this one should go green on a rerun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant