Skip to content

v0.20.0

Choose a tag to compare

@tya5 tya5 released this 14 Aug 09:48
· 4 commits to main since this release

Collapse a group in one operation, not N

FlowModel.set_hidden_many(entries, hidden) — show or hide a run of entries as a single change.

Hiding one entry at a time reflows per entry and re-runs the present band each time, so as the layout closes up, the entries sliding into the band get presented — a group collapse renders the very content it is collapsing.

Collapsing 200 of 2 000 entries, viewport 20 rows:

collapsed group is… one-by-one hide() set_hidden_many
at the viewport (you collapse what you're looking at) 573 ms, 104 presents 35 ms, 8 presents
entirely off-screen 201 ms, 0 presents 43 ms, 0 presents

Entry.hide() / show() / set_hidden() are unchanged — this adds a path, it doesn't replace one. examples/groups.py and the README now collapse via the batch, and the example's collapse-all does every group in a single call.

Verified while implementing: a bulk visibility change preserves the scroll anchor — the entry under the top edge stays there and the offset follows it.

Fixed

  • examples/groups.py bound c to collapse/expand-all, which FlowView itself has owned for the cursor toggle since 0.14.0 — the example's key silently did nothing. Rebound to a.
  • Corrected overstated figures published earlier in #13: the wasted-present() effect is real but requires the collapsing group to overlap the band, and the speedup is 4.7×–16×, not the 125× first reported.

Full changelog: https://github.com/tya5/textual-flowview/blob/main/CHANGELOG.md