Skip to content

Fix sticky scroll height calculation for variable line heights#3748

Open
utafrali wants to merge 2 commits intoeclipse-platform:masterfrom
utafrali:fix/issue-3745-line-height-changes-when-emoji-is-added-
Open

Fix sticky scroll height calculation for variable line heights#3748
utafrali wants to merge 2 commits intoeclipse-platform:masterfrom
utafrali:fix/issue-3745-line-height-changes-when-emoji-is-added-

Conversation

@utafrali
Copy link

When emoji or other content affects line heights, sticky scroll was calculating the total height wrong by assuming all lines were the same. Now it gets the actual height for each line instead. Also fixes the height check for limiting visible lines.

…ScrollingControl

Replace parameterless getLineHeight() calls with the offset-aware
getLineHeight(int offset) variant to correctly account for lines
containing emoji or other extended characters that increase line height.

- In calculateAndSetStickyLinesCanvasBounds(), sum per-line heights
  using stickyLineText.getLineHeight(offset) so the canvas bounds
  accurately reflect the actual rendered height of each sticky line.
- In limitVisibleStickyLinesToTextWidgetHeight(), use
  textWidget.getLineHeight(topOffset) so the visible line count
  estimate respects the actual height of the top visible line.
@BeckerWdf
Copy link
Member

@Christopher-Hermann can you pls. review?

@utafrali
Copy link
Author

Closing — can't sign the ECA.

@utafrali utafrali closed this Feb 27, 2026
@iloveeclipse
Copy link
Member

Closing — can't sign the ECA.

You mean, there is a technical problem or you won't sign?

@utafrali
Copy link
Author

Honestly I'm not comfortable with the obligations that come with signing the ECA — I feel like it goes against the open source spirit. Closing this one out.

@iloveeclipse
Copy link
Member

I feel like it goes against the open source spirit.

Could you please give some example? Eclipse contributors agreement is nowhere against open source. Whole Eclipse Foundation and all open source projects hosted here are based on work of people signed ECA.

@merks
Copy link
Contributor

merks commented Feb 27, 2026

Yes I too am genuinely interested in the concrete concerns! I’m on the Board of Directors IP Advisory Committee as an elected committer representative so I can raise any concerns at the highest levels. I’ve never heard anyone express concerns about signing the agreement coming with obligations. Mostly it is intended as an assertion that you authored the content and agree to make it available under the open source license. I’d like to understand how you see it differently. We want everyone to be included and valued in our community with no obligations beyond personal integrity.

@utafrali
Copy link
Author

utafrali commented Feb 27, 2026

Yeah, you're right. I think I just got spooked by the word "agreement" without actually looking into it. I've done a bit more reading and I'm happy to sign the ECA. Could you point me in the right direction for linking it to my GitHub account?

@merks
Copy link
Contributor

merks commented Feb 27, 2026

@merks merks reopened this Feb 27, 2026
@eclipse-platform-bot
Copy link
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

bundles/org.eclipse.ui.editors/META-INF/MANIFEST.MF
tests/org.eclipse.ui.editors.tests/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 2805cd948276a30b212a4e5f17303766160ce3ed Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Fri, 27 Feb 2026 19:21:29 +0000
Subject: [PATCH] Version bump(s) for 4.40 stream


diff --git a/bundles/org.eclipse.ui.editors/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.editors/META-INF/MANIFEST.MF
index 5a78bb6d2b..4277421c00 100644
--- a/bundles/org.eclipse.ui.editors/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.editors/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.ui.editors; singleton:=true
-Bundle-Version: 3.21.0.qualifier
+Bundle-Version: 3.21.100.qualifier
 Bundle-Activator: org.eclipse.ui.internal.editors.text.EditorsPlugin
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %providerName
diff --git a/tests/org.eclipse.ui.editors.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.ui.editors.tests/META-INF/MANIFEST.MF
index d9b8cb75c3..abb30a1d63 100644
--- a/tests/org.eclipse.ui.editors.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.ui.editors.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Plugin.name
 Bundle-SymbolicName: org.eclipse.ui.editors.tests;singleton:=true
-Bundle-Version: 3.14.0.qualifier
+Bundle-Version: 3.14.100.qualifier
 Bundle-Vendor: %Plugin.providerName
 Bundle-Localization: plugin
 Export-Package: org.eclipse.jface.text.tests.codemining,
-- 
2.53.0

Further information are available in Common Build Issues - Missing version increments.

@github-actions
Copy link
Contributor

Test Results

 3 024 files  ±0   3 024 suites  ±0   2h 1m 21s ⏱️ - 13m 10s
 8 235 tests +1   7 987 ✅ +1  248 💤 ±0  0 ❌ ±0 
23 529 runs  +3  22 738 ✅ +3  791 💤 ±0  0 ❌ ±0 

Results for commit 6ee96b2. ± Comparison against base commit 7695d24.

Copy link
Contributor

@Christopher-Hermann Christopher-Hermann left a comment

Choose a reason for hiding this comment

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

Thanks for providing a fix 👍

Productive coding lokos good. I added one comment about the test

Comment on lines +250 to +252
for (int i = 0; i < 2; i++) {
expectedHeight += stickyLineText.getLineHeight(stickyLineText.getOffsetAtLine(i));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about the test. I remember that it was kind of ugly to write proper assertions on the size since OS, rendering, etc. all effects the unit test. So having hard coded size will not work. But I guess this test would be green even without the fix, right?

What do you think about this idea:

  1. Set the 2 sticky lines as you did, get the stickyControlCanvas.getBounds().height
  2. Replace the second sticky line with something that requires more space. As far as I understand the description emoji for example? get the new height
  3. Assert that the new height (with emoji) is greater than the old height (without emoji)

I guess this would also be a good documentation of the actual bug, what do you think?

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.

6 participants