Skip to content

Support "reverse" in active-group-style for group headers#582

Open
zambetti wants to merge 1 commit into
Aloxaf:masterfrom
zambetti:support-reverse-active-group-style
Open

Support "reverse" in active-group-style for group headers#582
zambetti wants to merge 1 commit into
Aloxaf:masterfrom
zambetti:support-reverse-active-group-style

Conversation

@zambetti

@zambetti zambetti commented Jun 30, 2026

Copy link
Copy Markdown

Summary

Add support for reverse in active-group-style so the active completion group header can be highlighted reversed.

Changes

  • Accept reverse as a valid active-group-style token in lib/-ftb-fzf.
  • Apply reverse styling in lib/ftb-switch-group using ANSI SGR: on: 7 off: 27

Implementation

The previous implementation relied on hardcoded case branches for every style combination (bold, underline, bold,underline, etc.), which was rigid and didn’t scale.

This refactor takes a token-based approach, parsing style tokens once, and mapping each to its SGR codes to dynamically build the combined sequence. It also handles none more cleanly by short-circuiting. If none is present, all other style tokens are discarded and only none is applied, preventing conflicting or redundant formatting states.

This keeps behavior consistent while making it easier to extend and maintain.

Example

zstyle ':fzf-tab:*' active-group-style reverse bold

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