Skip to content

element/textbox: vertically center single-line selection highlight#88

Merged
vaxerski merged 1 commit into
hyprwm:mainfrom
UncleJ4ck:fix-textbox-selection-valign
Jun 3, 2026
Merged

element/textbox: vertically center single-line selection highlight#88
vaxerski merged 1 commit into
hyprwm:mainfrom
UncleJ4ck:fix-textbox-selection-valign

Conversation

@UncleJ4ck

@UncleJ4ck UncleJ4ck commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Single-line textboxes draw their text vertically centered (the VCENTER offset applied in CTextElement::paint), but the selection highlight was positioned at the pango layout top, so it sat above the glyphs instead of on them. Most visible on password fields.

Center the highlight to match when the textbox is single-line. Multiline selections are left alone since multiline text is top-aligned already.

Added a unit test that positions a single-line textbox, selects all with Ctrl+A, and asserts the highlight's vertical center lands on the textbox center. It fails without the fix.

@UncleJ4ck UncleJ4ck force-pushed the fix-textbox-selection-valign branch 2 times, most recently from 0f3d3e7 to 6c1852c Compare June 3, 2026 14:01
single-line text is drawn vcentered but the selection rect was placed at the
pango layout top, so the highlight sat above the glyphs. center it to match.
@UncleJ4ck UncleJ4ck force-pushed the fix-textbox-selection-valign branch from 6c1852c to d70f7fc Compare June 3, 2026 14:07

@vaxerski vaxerski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tnx

@vaxerski vaxerski merged commit a034284 into hyprwm:main Jun 3, 2026
2 checks passed
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