Skip to content

fix(views): paint text selection highlights behind text glyphs - #1098

Open
dst0 wants to merge 1 commit into
lapce:mainfrom
dst0:fix/selection-paint-order
Open

dst0 wants to merge 1 commit into
lapce:mainfrom
dst0:fix/selection-paint-order

Conversation

@dst0

@dst0 dst0 commented Dec 2, 2026

Copy link
Copy Markdown

Problem

In Label::paint and TextInput::paint, selection highlights were painted after text_layout.draw(...) (and in TextInput, after the preedit underline). That draws the selection fill on top of the text glyphs, reducing legibility (especially with opaque or high-alpha selection colors), whereas EditorView already paints selection highlights before text.

Solution

  • In Label::paint, call self.paint_selection(text_loc, cx) before l.draw(cx, text_loc).
  • In TextInput::paint, paint self.paint_selection_rect(cx) (when focused and a selection is active) inside the content clip region before text_layout.draw(...), keeping the existing clip, focus, preedit, and cursor-skip behavior unchanged.

Verification

  • cargo fmt --all --check: pass
  • cargo clippy -p floem --lib -- -D warnings: pass
  • cargo test -p floem --lib: 107 passed, 0 failed

This branch has not been deployed

No deployments
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