Bug 551320 - Missing line numbers when "Show Revision information" is enabled
Summary: Missing line numbers when "Show Revision information" is enabled
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.14   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.14 M1   Edit
Assignee: Thomas Wolf CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-20 10:47 EDT by Paul Pazderski CLA
Modified: 2019-11-21 11:01 EST (History)
2 users (show)

See Also:


Attachments
Missing line numbers (33.31 KB, image/png)
2019-09-20 10:47 EDT, Paul Pazderski CLA
no flags Details
smaller issue left after patch https://git.eclipse.org/r/150115 (325.12 KB, image/png)
2019-09-25 09:17 EDT, Andrey Loskutov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Pazderski CLA 2019-09-20 10:47:06 EDT
Created attachment 279956 [details]
Missing line numbers

See attached screenshot. Some line numbers are not drawn when scrolling and "Show Revision information" is enabled.

This is a regression from recent line ruler painting optimization in bug 366471.
https://git.eclipse.org/r/#/c/149547/

I definitely tested the quick diff part but apparently forgot the "Show Revision information" variant.

Thomas please take a look.

PS: I made a new bug since the other is very long and this title easier to find.
Comment 1 Thomas Wolf CLA 2019-09-20 11:39:11 EDT
I *had* tested that, but not with the latest patch set.

Damn. The LineNumberChangeRulerColumn paints way beyond the line range given.

So this is caused by the final "optimization" drawing directly into the buffer in the non-scaled case. So back one step and always paint into a new image, then only copy the wanted image parts.
Comment 2 Andrey Loskutov CLA 2019-09-20 11:43:10 EDT
I'm on I20190919-1800 / Linux, can'r reproduce. What are the steps?
Comment 3 Paul Pazderski CLA 2019-09-20 11:49:39 EDT
Enable "Show Revision information" and line numbers as seen in screenshot (exact configuration shouldn't matter) and scroll editor. The revision information blocks should be at least larger than 2 lines and you must not place or move the mouse onto the ruler.
Comment 4 Paul Pazderski CLA 2019-09-20 11:51:23 EDT
(In reply to Thomas Wolf from comment #1)
> So this is caused by the final "optimization" drawing directly into the
> buffer in the non-scaled case.

Too bad. But I assume you could keep it this way for the dy == 0 case where the whole canvas is drawn anyway.
Comment 5 Andrey Loskutov CLA 2019-09-20 12:01:17 EDT
(In reply to Paul Pazderski from comment #3)
> Enable "Show Revision information" and line numbers as seen in screenshot
> (exact configuration shouldn't matter) and scroll editor. The revision
> information blocks should be at least larger than 2 lines and you must not
> place or move the mouse onto the ruler.

OK, I see it sometimes now, the "right scrolling" with the mouse is the key.
Comment 6 Eclipse Genie CLA 2019-09-20 12:15:00 EDT
New Gerrit change created: https://git.eclipse.org/r/149918
Comment 8 Thomas Wolf CLA 2019-09-20 14:18:26 EDT
BTW: the Mac-retina specific work-around doesn't seem to be needed anymore? See bug 516293, and the meanwhile fixed bug bug 489451.
Comment 9 Andrey Loskutov CLA 2019-09-24 10:59:27 EDT
Still broken, I'm on I20190923-1800 / GTK3.

I see line numbers not painted for some lines (trying to create a screenshot paints them).

I was working on eclipse.platform.resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/BuilderTest.java

with JUnit / breakpoints and while navigating from failing test to the line / toggling breakpoints I've noticed that in few cases single line numbers were not there.

Jump to testBuildClean() via Outline view and scroll down with the mouse.
Comment 10 Thomas Wolf CLA 2019-09-25 02:26:26 EDT
(In reply to Andrey Loskutov from comment #9)
> Still broken, I'm on I20190923-1800 / GTK3.
> 
> I see line numbers not painted for some lines (trying to create a screenshot
> paints them).
> 
> I was working on
> eclipse.platform.resources/tests/org.eclipse.core.tests.resources/src/org/
> eclipse/core/tests/internal/builders/BuilderTest.java
> 
> with JUnit / breakpoints and while navigating from failing test to the line
> / toggling breakpoints I've noticed that in few cases single line numbers
> were not there.
> 
> Jump to testBuildClean() via Outline view and scroll down with the mouse.

Can reproduce on CentOS 7/GTK3/X11 (Gnome, Adwaita) *only with static scrollbars*. Doesn't occur with the default Gnome overlay scrollbars.

Vertical pixel coordinates are off between the rectangle copied in doubleBufferPaint() and where doPaint() paints the lines. Setting the cursor on the bottom line visible and hitting arrow-down once reproduces the problem reliably for me (with static scrollbars on). Coordinate difference depends on font size and is about two lines, so doPaint paints the correct two lines, but above the area that is then copied.

No idea why this happens. If I can't figure out what's going on, I'll disable this for GTK tomorrow.
Comment 11 Andrey Loskutov CLA 2019-09-25 02:33:14 EDT
(In reply to Thomas Wolf from comment #10)
> Can reproduce on CentOS 7/GTK3/X11 (Gnome, Adwaita) *only with static
> scrollbars*. Doesn't occur with the default Gnome overlay scrollbars.

Right, overlay scrollbars are off for me, because they cause permanent redraw events (x20 more) and are bad if using Eclipse over slow ssh or vnc connection. 

Since overlay scrollbars cause extra redraws after scrolling, we don't see the bug if they are enabled.
Comment 12 Thomas Wolf CLA 2019-09-25 02:47:32 EDT
No such problem on Mac, with either static or dynamic scrollbars.
Comment 13 Thomas Wolf CLA 2019-09-25 05:57:26 EDT
I have the feeling that this might be related to bug 519728 comment 18. I sometimes see line numbers being painted next to the static horizontal scrollbar, and sometimes not. When not, scrolling up one line leads to missing line numbers on the last two lines.
Comment 14 Eclipse Genie CLA 2019-09-25 08:31:35 EDT
New Gerrit change created: https://git.eclipse.org/r/150115
Comment 15 Thomas Wolf CLA 2019-09-25 08:35:22 EDT
(In reply to Eclipse Genie from comment #14)
> New Gerrit change created: https://git.eclipse.org/r/150115

(In reply to Thomas Wolf from comment #13)
> I sometimes see line numbers being painted next to the static horizontal
> scrollbar, and sometimes not.

...and error markers, too. So... sometimes JFaceTextUtil.getVisibleModelLines() returns as last line the one above the static scrollbar (case 1), and sometimes it returns a line that isn't visible at all because it's hidden behind the horizontal scrollbar (case 2). Seems to occur when the font size is such that the line height is larger than the height of that scrollbar.

The basic assumption that the height of the ruler canvas was always equal to the height of the visible text area in the text viewer seems not to hold (at least on GTK); the ruler canvas can be larger. On Mac, this assumption holds; with static scrollbars the ruler canvas stops at the top of the horizontal scrollbar.

The above change corrects LineNumberRulerColumn for the case that the bottom pixel of the reported bottom line is < the height of the canvas (that's case 1).

Verified on OS X and GTK with static and dynamic scrollbars and found no problems.

@Andrey, can you confirm, or do you still see rendering problems with this change?

And could someone test this on Windows, please?
Comment 16 Paul Pazderski CLA 2019-09-25 08:44:08 EDT
(In reply to Thomas Wolf from comment #15)
> And could someone test this on Windows, please?

Tested. Everything seems fine.
Comment 17 Thomas Wolf CLA 2019-09-25 09:06:10 EDT
(In reply to Paul Pazderski from comment #16)
> (In reply to Thomas Wolf from comment #15)
> > And could someone test this on Windows, please?
> 
> Tested. Everything seems fine.
Thanks, Paul!
Comment 18 Andrey Loskutov CLA 2019-09-25 09:17:22 EDT
Created attachment 280025 [details]
smaller issue left after patch https://git.eclipse.org/r/150115

Thanks Thomas, looks better now, I've commented on the patch, see attached screenshot
Comment 19 Thomas Wolf CLA 2019-09-25 09:24:48 EDT
(In reply to Andrey Loskutov from comment #18)
> Created attachment 280025 [details]
> smaller issue left after patch https://git.eclipse.org/r/150115
> 
> Thanks Thomas, looks better now, I've commented on the patch, see attached
> screenshot

I don't have that on CentOS7/GTK/X11/Gnome/Adwaita. But my static scrollbars look completely differently. Do you get those when scrolling up or down? Or after a down-up-down? And what theme is that? If not Adwaita: do you also get that with Adwaita?

If I can't reproduce this one we're not only into "SWT platform differences" territory but also deep in "Linux UI theme differences" area, where I definitely can't do much.
Comment 20 Andrey Loskutov CLA 2019-09-25 09:33:15 EDT
(In reply to Thomas Wolf from comment #19)
> I don't have that on CentOS7/GTK/X11/Gnome/Adwaita. But my static scrollbars
> look completely differently. 

Yes, I'm using https://github.com/iloveeclipse/clearlooks-phenix

> Do you get those when scrolling up or down? 

Scrolling up with mouse wheel. Scrolling down works fine.

> And what theme is that? If not Adwaita: do you also
> get that with Adwaita?

Same with Adwaita (except that scrollbar is tiny and so the damaged area is smaller).
Comment 21 Thomas Wolf CLA 2019-09-25 10:42:17 EDT
OK, managed to reproduce it.

(In reply to Thomas Wolf from comment #15)
> sometimes JFaceTextUtil.getVisibleModelLines() returns as last line the
> one above the static scrollbar (case 1)

The "sometimes" was a problem. If we had this case and cleared the bottom bit, and then the next case when scrolling down was not case 1, the code even copied the cleared part up when scrolling down.

And the bits shown in your screenshot come from a similar problem with scrolling up, which would not copy enough down and thus leave garbage in that little bit. For scrolling up, we can always use the ruler's canvas height.

There's a minor-minor-minor difference to the old behavior in that one can see partial line numbers next to the scrollbar (bottom beyond the viewer) when scrolling up. I consider that OK; in fact, it's symmetric to the top line numbers, which also can be shown with their tops cut off.

I kind of start hating this :-/ The code was so simple originally, and now it's riddled with crazy special cases just because that canvas is sized differently on GTK. :-(

At least performance-wise it's still quite a bit faster on Mac compared to before I started fiddling with this.

@Andrey: Hope you don't find any more problems now.