Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326905

Summary: [painting] White space wrongly rendered after horizontal scrolling
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: TextAssignee: Deepak Azad <deepakazad>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.7Flags: markus.kell.r: review+
Target Milestone: 3.7 M3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
fix none

Description Markus Keller CLA 2010-10-04 07:05:56 EDT
N20101003-2000

White space is sometimes wrongly rendered after horizontal scrolling in the editor.

Checked options in prefs: Leading spaces, trailing spaces & tabs.
Rest unchecked.

When I now open a file that contains lines with leading tabs (e.g. a .project file), make the editor narrow such that the horizontal scroll bar appears, and then scroll horizontally, then leading tabs are sometimes also rendered.

If you scroll very quickly, it sometimes renders correctly.
Comment 1 Markus Keller CLA 2010-10-04 08:20:36 EDT
With the same options, I also see spaces painted when I have a sequence of multiple "enclosed" spaces (e.g. "int          foo= 1;" and then select one or more of these spaces. Single spaces are OK.
Comment 2 Deepak Azad CLA 2010-10-07 00:18:11 EDT
Created attachment 180383 [details]
fix

As correctly pointed out by Markus, the problem was that the whole line is not always painted, and as a result the computation of textBegin and textEnd was wrong.
Comment 3 Deepak Azad CLA 2010-10-07 00:20:36 EDT
Markus, please commit the patch if it looks good to you.
Comment 4 Markus Keller CLA 2010-10-07 09:58:20 EDT
Thanks, looks good and works fine, committed to HEAD.

The fix adds a second call to StyledTextContent#getTextRange(int, int) that copies the char[] twice (if I remember correctly...). This can be improved with bug 326419.