Skip to content

Fix replaceTextRange logic for unfocused StyledText with variable line height #2318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tobiasmelcher
Copy link
Contributor

  • Updated productive code to prevent IllegalArgumentException when replacing text in a StyledText control with variable line height and no focus, by adding boundary checks.
  • Added a regression test to validate the fix: ensures no exception is thrown when replacing the full text range under these conditions.

Fixes: #2302

@tobiasmelcher
Copy link
Contributor Author

@HeikoKlare could you please take a look and review? Do you think that the boundary checks do make sense?

Copy link
Contributor

github-actions bot commented Jul 16, 2025

Test Results

   546 files  ±0     546 suites  ±0   28m 53s ⏱️ - 2m 8s
 4 408 tests +1   4 391 ✅ +1   17 💤 ±0  0 ❌ ±0 
16 717 runs  +4  16 590 ✅ +4  127 💤 ±0  0 ❌ ±0 

Results for commit 4b1f261. ± Comparison against base commit 95b46b6.

♻️ This comment has been updated with latest results.

height

- Updated productive code to prevent IllegalArgumentException when
replacing text in a StyledText control with variable line height and no
focus, by adding boundary checks.
- Added a regression test to validate the fix: ensures no exception is
thrown when replacing the full text range under these conditions.

Fixes: eclipse-platform#2302
@tobiasmelcher tobiasmelcher force-pushed the styled_text_index_out_of_bounds branch from 747348b to 4b1f261 Compare July 16, 2025 15:26
Copy link
Contributor

@BeckerWdf BeckerWdf left a comment

Choose a reason for hiding this comment

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

A don't know that code good enough to really be able to judge on this.

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.

Regression for programmatic deletion of text from non-focused StyledText with non-fixed line-height
3 participants