Skip to content

fix(statusline): preserve styles when sections are hidden - #356

Merged
fcoury merged 1 commit into
mainfrom
fcoury/statusline-empty-styles
Sep 3, 2026
Merged

fcoury merged 1 commit into
mainfrom
fcoury/statusline-empty-styles

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Opening a file outside Git hides the branch segment, but the filename inherits an earlier slot's color because styles were assigned after empty sections were removed.

Keep each section's style tied to its configured position on both sides of the statusline. Hidden sections take no space, and separators connect the remaining backgrounds. Update the diagnostics documentation and cover missing Git sections, diagnostics appearing and disappearing, and redraws that must clear stale styling.

How to Test

  1. With the default statusline layout, open a Markdown file outside a Git repository. The filename should use the base statusline background, with a direct transition from NORMAL and no extra color band or separator after the filename.
  2. Switch to a file inside Git, then back to the outside file. The branch should appear and disappear without changing the filename's colors. Open :statusline and cancel with Escape; the statusline should retain the same styling.
  3. Run cargo test -p red --lib statusline. The left/right regression tests verify that diagnostics do not recolor neighboring sections and that clearing diagnostics restores the original frame. The missing-Git test checks both colors and separators with consecutive hidden sections.

Validated at 79bdf544: all 32 statusline tests passed; cargo fmt --all -- --check and cargo clippy --all-targets --all-features -- -D warnings passed. The color-enabled TUI walkthrough above also passed.

@fcoury
fcoury merged commit 144da39 into main Sep 3, 2026
12 checks passed
@fcoury
fcoury deleted the fcoury/statusline-empty-styles branch September 3, 2026 01: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.

2 participants