Community
Participate
Working Groups
Created attachment 280766 [details] Not claimed horizontal space after text change StyledTextRenderer tracks the width of the longest line. This value can be wrong because the current max width is not correctly invalidated on some text changes. This first situation can be reproduced by scrolling to the right end of the control and remove some text from the longest line and (in the same operation) something from the next line. See attached screenshot for the steps and result. It should claim the free horizontal space but did not as you can see on the still available horizontal scroll bar. This test case is derived from bug 343086. It is also triggered by wrong max width and an additional bug in StyledText. Another impact of this bug I found can be triggered programmatically. When the longest line is not currently visible and this longest line is changed the horizontal scroll bar is updated for the second longest line (the longest line not modified by the change event). This is automatically corrected as soon as the longest line is visible again.
I wanted to make a minimal change which worked for the first case but not for the second. The first problem arise in StyledTextRenderer#textChanging. As last step it updates max width if the current max width line is part of the change. But the code block before can change the startLine variable which breaks the test if longest line is part of the change. But the update of max width itself is invalid. It calculates the longest line on partial unavailable data and the result is the longest known(!) line and not the longest of all lines. My proposed solution is to calculate max width more on demand. If the current max width is known we update it as we can but if not, e.g. a content change changed the max line the recalculation of max width is postponed until the width is actually needed.
New Gerrit change created: https://git.eclipse.org/r/153247
Had not yet found the reason for test failure so need to move target milestone.
Finally got this awful failure. Apparently the test was only failing on gerrit because of different system font... Will merge after M1.
Gerrit change https://git.eclipse.org/r/153247 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=795aeac59686647adf9dd0ea194583482609ac01
Reopened because fix was reverted.