Skip to content

label: Skip highlights while masked - #3142

Merged
huacnlee merged 4 commits into
longbridge:mainfrom
violetpurpleish:codex/fix-masked-label-highlights
Sep 20, 2026
Merged

huacnlee merged 4 commits into
longbridge:mainfrom
violetpurpleish:codex/fix-masked-label-highlights

Conversation

@violetpurpleish

@violetpurpleish violetpurpleish commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

Masked labels replace source text with bullets. Applying secondary-text or matching highlight ranges to the masked string can reuse source byte offsets, including offsets that are not valid UTF-8 boundaries in the displayed bullet string and can panic during rendering. Styled ranges can also reveal information about the structure of concealed text.

Skip highlight measurement entirely while a Label is masked. This keeps every bullet visually uniform, avoids unnecessary matching and range conversion work, and leaves unmasked highlighting behavior unchanged.

The Label Story now includes a Mask toggle in the Highlighting section so the interaction can be tested directly. The existing balance example is restored to its original content.

Public API

No API signatures change. Label::masked(true) now suppresses all highlight styles, including matching highlights and primary/secondary color segmentation.

Behavior Change

Masked labels no longer preserve visible highlight colors. This is intentional: concealed text should not expose matching or segment boundaries. Unmasking restores the configured highlights.

How to Test

  • cargo test -p gpui-component --features test-support --lib --locked: 556 passed.
  • cargo check -p gpui-component-story --locked: passed.
  • Label Story > Highlighting: enter a matching query, toggle Mask on, and verify all bullets use a uniform style with no highlighted segment. Toggle Mask off and verify the matching highlight returns.

AI-assisted implementation with Codex; diff reviewed and regression checks run.

huacnlee

This comment was marked as resolved.

huacnlee
huacnlee previously approved these changes Sep 20, 2026
@huacnlee
huacnlee enabled auto-merge (squash) September 20, 2026 13:14
@huacnlee
huacnlee disabled auto-merge September 20, 2026 13:14
@huacnlee huacnlee changed the title label: Map masked highlights to displayed UTF-8 boundaries label: Skip highlights while masked Sep 20, 2026
@huacnlee
huacnlee enabled auto-merge (squash) September 20, 2026 13:15
@huacnlee huacnlee added this to the 0.7.0 milestone Sep 20, 2026
@huacnlee
huacnlee merged commit cb835e4 into longbridge:main Sep 20, 2026
11 checks passed
@violetpurpleish
violetpurpleish deleted the codex/fix-masked-label-highlights branch September 20, 2026 14:52
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