Skip to content

Conversation

@EmmanuelDodoo
Copy link
Contributor

The previous implementation of hit_span incorrectly handled visual breaks. Empty spaces at the end of a line were considered as part of the last span. This PR fixes it so empty spaces are ignored. The code is modified version of the span_bounds implementation.

Before
![Screencast From 2025-10-08 11-47-09(1)](https://github.com/user-attachments/assets/b7342e15-1828-49a9-9f33-ec9654f9d09b behaviour before the fix)

After
![Screencast From 2025-10-08 20-30-45](https://github.com/user-attachments/assets/336a3af9-9aab-447f-a76a-e7b5e8aa9171 behaviour after the fix)

@hecrj hecrj added this to the 0.14 milestone Nov 29, 2025
@hecrj hecrj added bug Something isn't working text layout fix labels Nov 29, 2025
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

Thanks!

I've been able to fix it while keeping the original simpler implementation.

Well, technically there is still an edge case where half a glyph won't be clickable at the end of the line. But let me sleep on that.

@hecrj hecrj enabled auto-merge November 29, 2025 18:23
@hecrj hecrj merged commit 5206f9a into iced-rs:master Nov 29, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fix layout text

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants