Skip to content

Conversation

@ShahzaibIbrahim
Copy link
Contributor

@ShahzaibIbrahim ShahzaibIbrahim commented Dec 18, 2025

Because of rounding errors the bracket selection highlight is often inconsistent. Making use of residual values provides precise rectangle values and highlight is consistent across all zooms

Problem: At 250% (the problem is also there for all zooms, at 250 its just better visible), After every three line the fourth line x axis is bit too much on the left. (rounding error)

line 29: the width of highlight is 17px

image

line 30: the width of highlight is 16px

image

How to test

  • Run the runtime workspace with monitor-specific scaling turned on
  • Add some brackets in Java file { }
  • Select the opening bracket, the closing bracket will be highlighted.
  • See if the rectangle around highlighted bracket is surrounded the bracket correctly (no-cutoffs)

Result

Before Fix:
image

After Fix:
image

Requires:

@github-actions
Copy link
Contributor

github-actions bot commented Dec 18, 2025

Test Results

 3 015 files  ±0   3 015 suites  ±0   2h 12m 1s ⏱️ - 3m 56s
 8 258 tests ±0   8 010 ✅ ±0  248 💤 ±0  0 ❌ ±0 
23 598 runs  ±0  22 807 ✅ ±0  791 💤 ±0  0 ❌ ±0 

Results for commit d0b4a1c. ± Comparison against base commit 93acda3.

♻️ This comment has been updated with latest results.

@ShahzaibIbrahim ShahzaibIbrahim changed the title Bracket selection square too small Use stable Y-coordinate for character highlight and adjust height Dec 22, 2025
@ShahzaibIbrahim ShahzaibIbrahim marked this pull request as ready for review December 22, 2025 13:12
@ShahzaibIbrahim ShahzaibIbrahim changed the title Use stable Y-coordinate for character highlight and adjust height Use OfFloat Point values to create precise highlight brackets Dec 22, 2025
@ShahzaibIbrahim ShahzaibIbrahim force-pushed the master-521 branch 2 times, most recently from 59f94d1 to a309909 Compare January 8, 2026 14:39
Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

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

Is it intended that with removing the -1 from the height calculation, the highlight is now too high and exceeds the line?
image

Before:
image

@ShahzaibIbrahim
Copy link
Contributor Author

Is it intended that with removing the -1 from the height calculation, the highlight is now too high and exceeds the line? image

Before: image

Yes, it is intended. We either cutoff the highlighted bracket or we go over the line.

@HeikoKlare
Copy link
Contributor

So if I understand correctly, we have two issues with two solutions here:

  1. The highlight is drawn over the bracket, which is solved by removing the -1.
  2. The highlight is too small on higher zooms because of bad rounding, which is solved by using Rectangle.of().

If propose to make two separate PRs, one for each of the issues, out of this. While the usage of Rectangle.of() to solve the scaling issue should be without any discusionss, the -1 has been added intentionally to make the highlight fit to the line, so changing that behavior might be more of a discussion.

Because of rounding errors the bracket selection highlight is often
inconsistent. Making use of residual values provides precise rectangle
values and highlight is consistent across all zooms
@ShahzaibIbrahim
Copy link
Contributor Author

So if I understand correctly, we have two issues with two solutions here:

  1. The highlight is drawn over the bracket, which is solved by removing the -1.
  2. The highlight is too small on higher zooms because of bad rounding, which is solved by using Rectangle.of().

If propose to make two separate PRs, one for each of the issues, out of this. While the usage of Rectangle.of() to solve the scaling issue should be without any discusionss, the -1 has been added intentionally to make the highlight fit to the line, so changing that behavior might be more of a discussion.

This PR now keep the height as it was before. The other PR that increases the height is here: #3653

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.

Bracket selection square too small in some zooms

2 participants