Skip to content

TreeView: HideRoot renders the root's children as a forest - #214

Merged
tannevaled merged 1 commit into
mainfrom
feat/treeview-hideroot
Aug 16, 2026
Merged

TreeView: HideRoot renders the root's children as a forest#214
tannevaled merged 1 commit into
mainfrom
feat/treeview-hideroot

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

What

TreeView always rendered its single Root as the top row, forcing every other entry one indent level deeper. A host that wants its top-level items flush — e.g. a sidebar whose "All Sources" row should not indent the folders/subscriptions below it — had no way to omit the root row.

Change

HideRoot bool: when true, flatten skips the root's own row and walks its children at depth 0 (the root's Expanded flag is ignored, since it is no longer a visible/collapsible row). Selection, keyboard and hit-testing already operate on the flattened rows, so they need no change. The zero value keeps the original root-visible behaviour, byte-identical to before.

Tests / gates

  • New test covers forest flattening (children at depth 0, descendants nested), root-never-visible, the ignored root Expanded, and the HideRoot=false fallback.
  • 100% statement coverage; gofmt + go vet clean.

🤖 Generated with Claude Code

A TreeView always rendered its single Root as the top row, so every other entry
sat one indent level deeper — a host that wants its top-level items flush (e.g. a
sidebar whose "All Sources" row should not indent the folders and subscriptions
below it) had no way to omit the root. HideRoot makes flatten skip the root row
and walk its children at depth 0 (ignoring the root's own Expanded flag, since it
is no longer a visible, collapsible row). Selection, keyboard and hit-testing
already operate on the flattened rows, so they need no change. The zero value
keeps the original root-visible behaviour.

100% statement coverage; gofmt + vet clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 165adf1 into main Aug 16, 2026
1 check passed
@tannevaled
tannevaled deleted the feat/treeview-hideroot branch August 16, 2026 16:36
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