Bug 490951 - Overview ruler inverted when using themed StyledText scroll bar
Summary: Overview ruler inverted when using themed StyledText scroll bar
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 4.6 M7   Edit
Assignee: Fabio Zadrozny CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 401230 (view as bug list)
Depends on:
Blocks: 424501 430278
  Show dependency tree
 
Reported: 2016-04-02 04:36 EDT by Dani Megert CLA
Modified: 2016-04-25 08:12 EDT (History)
3 users (show)

See Also:


Attachments
Picture showing square on Linux (95.07 KB, image/png)
2016-04-13 11:04 EDT, Dani Megert CLA
no flags Details
Linux screenshot on variable-sized scroll bar (76.86 KB, image/png)
2016-04-13 11:56 EDT, Fabio Zadrozny CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2016-04-02 04:36:05 EDT
The overview ruler is not correctly rendered. The red/yellow square at the bottom should be at the top.

1. switch to Dark theme
2. restart
3. paste:
class Bug {
 bug
}
Comment 1 Fabio Zadrozny CLA 2016-04-02 09:41:32 EDT
Just to note, this is happening even without the themed scrollbars for me (so, doesn't seem related to 430278).

I.e.: In default theme, open file > make error as the first thing > red square appears at bottom > switch focused editor > red square appears at top again.

If file is saved with error and reopened the red square also appears at the bottom.
Comment 2 Fabio Zadrozny CLA 2016-04-02 10:24:47 EDT
Ok, I investigated a bit more and this seems a deliberate choice: if there are no arrows, draw things at the bottom... this has always happened at PyDev because it hides the vertical bar -- now I know why ;)

So, this is a side-effect of hiding the scroll-bars to draw the themed bar -- also, reproducing in the classic layout doesn't always happen (although also probably related).

Still, when showing things at the bottom, the overview ruler has some issues: it seems that the error indicator and the bar for other things can overlap... also, it's drawing a strange line in the end when it's at the bottom (because at org.eclipse.jface.text.source.OverviewRuler.HeaderPainter.paintControl(PaintEvent), line 302 it'll draw it if !isOnTop.

I'm not sure whether the best place would be at the top or bottom in this case (the idea seems to be aligning with the horizontal bar at the bottom as there are no arrows, so, I'm considering keeping this behavior).

I'm on to fix the overlap and drawing of the un-needed line (it's even stranger because the line is drawn at the bottom, so, effectively it's separating nothing -- but I think not having any line would be better in this case, even if it was at the proper position).
Comment 3 Fabio Zadrozny CLA 2016-04-03 14:32:22 EDT
Ok, one more step in my understanding of the related code:

I was investigating a bit more and discovered that in Linux it actually does not show the red/yellow square at the bottom (because the scroll bar on Linux does not have any arrows).

Also, the current version has some bugs if the scroll bars are hidden (because it asks for the scroll bar thumb size and it returns 0 in this case -- and all the computations from there on become wrong).

So, I'm going to submit a pull request which fixes those issues: the red/yellow square will be invisible (as it is on Linux) when the scroll bar is hidden and a proper thumb size is computed -- this make the overview ruler work properly again even if the scroll bar is invisible (which for all practical purposes is the case on the themed scroll bar).
Comment 4 Eclipse Genie CLA 2016-04-03 14:37:47 EDT
New Gerrit change created: https://git.eclipse.org/r/69791
Comment 5 Fabio Zadrozny CLA 2016-04-05 06:42:49 EDT
Anyone available to take a look at the pull request ( https://git.eclipse.org/r/69791 )? 

i.e.: this fixes overview ruler in eclipse.platform.text to work properly when an editor doesn't have scroll bars (without this fix annotations stay at the wrong position and the red/yellow square is using the same space that the overview ruler occupies).
Comment 6 Lars Vogel CLA 2016-04-05 07:07:47 EDT
(In reply to Fabio Zadrozny from comment #5)
> Anyone available to take a look at the pull request (
> https://git.eclipse.org/r/69791 )? 

I hope that Dani will do this. He found the issue and is very familiar with eclipse.platform.text.

Dani?
Comment 7 Fabio Zadrozny CLA 2016-04-07 08:16:25 EDT
Ping?

As a note, I think this is a pretty critical fix... the way it is, the overview ruler layout is wrong (and the annotations also appear in the wrong place).
Comment 8 Dani Megert CLA 2016-04-13 11:03:47 EDT
(In reply to Fabio Zadrozny from comment #1)
> Just to note, this is happening even without the themed scrollbars for me
> (so, doesn't seem related to 430278).
> 
> I.e.: In default theme, open file > make error as the first thing > red
> square appears at bottom > switch focused editor > red square appears at top
> again.

On which platform? I cannot reproduce this on Windows. If you can, please provide exact steps.


> I was investigating a bit more and discovered that in Linux it actually does 
> not show the red/yellow square at the bottom (because the scroll bar on Linux > does not have any arrows).

That's not true, see attached picture taken from a Linux box. Your proposed change breaks this, i.e. removes the summary square.
Comment 9 Dani Megert CLA 2016-04-13 11:04:28 EDT
Created attachment 260926 [details]
Picture showing square on Linux
Comment 10 Fabio Zadrozny CLA 2016-04-13 11:56:23 EDT
(In reply to Dani Megert from comment #8)
> (In reply to Fabio Zadrozny from comment #1)
> > Just to note, this is happening even without the themed scrollbars for me
> > (so, doesn't seem related to 430278).
> > 
> > I.e.: In default theme, open file > make error as the first thing > red
> > square appears at bottom > switch focused editor > red square appears at top
> > again.
> 
> On which platform? I cannot reproduce this on Windows. If you can, please
> provide exact steps.

Humm, this happened to me only with those same steps on windows (although now that I got the latest build I can no longer reproduce it anymore here either... I'll keep that on the background for now, if I can reproduce it in a more consistent way I'll create a bug for that/try to debug it and give more details and possibly a fix).

 
> > I was investigating a bit more and discovered that in Linux it actually does 
> > not show the red/yellow square at the bottom (because the scroll bar on Linux > does not have any arrows).
> 
> That's not true, see attached picture taken from a Linux box. Your proposed
> change breaks this, i.e. removes the summary square.

Actually, I think you're comparing with the case which is not the same as the case for the themed scroll bar (which is smaller when there's no mouse interaction and becomes bigger when the mouse hovers over the scroll).

For that use-case, it doesn't show it (I'm attaching a screenshot), so, I'd like you to reconsider it -- also, it doesn't change the behavior of the native case (so, it doesn't break it, just makes it compatible with the same use-case) and makes it consistent with the case when there's no visible scroll bar (where showing the square is odd as the layout has no real space for it).

So, I'd like you to reconsider it given that it's consistent with the use-case where the scroll bar changes size (and it keeps the behavior when there's a fixed size scroll bar).
Comment 11 Fabio Zadrozny CLA 2016-04-13 11:56:54 EDT
Created attachment 260930 [details]
Linux screenshot on variable-sized scroll bar
Comment 12 Fabio Zadrozny CLA 2016-04-13 12:04:21 EDT
Actually, I saw what you meant now... if there's a scroll with fixed size < 6px it'll go down and my change makes it invisible... I'll fix that so that the current use case is kept.
Comment 13 Fabio Zadrozny CLA 2016-04-13 12:32:07 EDT
Ok, just updated https://git.eclipse.org/r/#/c/69791/ to keep the old behavior (when arrow size < 6, but still > 0).
Comment 14 Dani Megert CLA 2016-04-14 06:23:24 EDT
(In reply to Fabio Zadrozny from comment #13)
> Humm, this happened to me only with those same steps on windows (although
> now that I got the latest build I can no longer reproduce it anymore here
> either... I'll keep that on the background for now, if I can reproduce it in
> a more consistent way I'll create a bug for that/try to debug it and give
> more details and possibly a fix).

Bug 485540 contains steps and a fix. Please retest against the latest master and if still necessary, update your latest Gerrit change.
Comment 15 Fabio Zadrozny CLA 2016-04-14 08:48:28 EDT
The error is still there (and the gerrit review -- just updated -- fixes it).

As a note, to reproduce the issue, create a file with the contents below -- you can see that the annotations are all far off and clicking on the overview ruler doesn't provide a proper mapping to the editor.

--------------
package scroll;

public class CheckLock {

	public static void main(String[] args) {
		
		// comments
		// comments
		// comments
		// comments
		// comments
		// comments
		
	}
}


error
error



// comments
// comments
// comments
// comments
// comments
// comments
// comments
// comments
// comments
// comments
// comments
// comments
// comments
// comments
// comments
// comments
// comments
// comments

error
error
--------------
Comment 16 Dani Megert CLA 2016-04-15 10:30:24 EDT
(In reply to Fabio Zadrozny from comment #15)
> The error is still there (and the gerrit review -- just updated -- fixes it).

This version still removes the square on Linux.
Comment 17 Fabio Zadrozny CLA 2016-04-15 10:48:11 EDT
(In reply to Dani Megert from comment #16)
> (In reply to Fabio Zadrozny from comment #15)
> > The error is still there (and the gerrit review -- just updated -- fixes it).
> 
> This version still removes the square on Linux.

But this is the idea when the scrollbar is themed as that's consistent with the behavior of the scroll which has a variable size (or do you mean it removes the square on the native version too?)
Comment 18 Dani Megert CLA 2016-04-15 10:50:24 EDT
(In reply to Fabio Zadrozny from comment #17)
> (In reply to Dani Megert from comment #16)
> > (In reply to Fabio Zadrozny from comment #15)
> > > The error is still there (and the gerrit review -- just updated -- fixes it).
> > 
> > This version still removes the square on Linux.
> 
> But this is the idea when the scrollbar is themed as that's consistent with
> the behavior of the scroll which has a variable size (or do you mean it
> removes the square on the native version too?)

Sorry, but we won't remove this feature for Linux users just because of the themed scroll bar. No way.
Comment 19 Dani Megert CLA 2016-04-15 10:51:23 EDT
(In reply to Dani Megert from comment #18)
> (In reply to Fabio Zadrozny from comment #17)
> > (In reply to Dani Megert from comment #16)
> > > (In reply to Fabio Zadrozny from comment #15)
> > > > The error is still there (and the gerrit review -- just updated -- fixes it).
> > > 
> > > This version still removes the square on Linux.
> > 
> > But this is the idea when the scrollbar is themed as that's consistent with
> > the behavior of the scroll which has a variable size (or do you mean it
> > removes the square on the native version too?)
> 
> Sorry, but we won't remove this feature for Linux users just because of the
> themed scroll bar. No way.

Yep, it removes it on the native version on Linux.
Comment 20 Fabio Zadrozny CLA 2016-04-15 11:03:24 EDT
Ok, sorry then, it shouldn't do that (it should only remove it when it's in the themed version). 

I'll take a better look at this (maybe it works for me because of a different Linux theme).

Can you give more details on the Linux flavor/theme you're using so that I can properly reproduce it? (i.e.: how can I reproduce exactly that screenshot you took).
Comment 21 Dani Megert CLA 2016-04-15 11:26:35 EDT
(In reply to Fabio Zadrozny from comment #20)
> Can you give more details on the Linux flavor/theme you're using so that I
> can properly reproduce it? (i.e.: how can I reproduce exactly that
> screenshot you took).

Ubuntu 12.04, GTK 3.4.2, Metacity, Ambiance theme (default).
Comment 22 Fabio Zadrozny CLA 2016-04-15 19:25:04 EDT
Hi Dani,

Great, I was able to reproduce it here (it was actually the same env I had, the detail was setting LIBOVERLAY_SCROLLBAR to 0 or 1 to get a different behavior).

So, I just updated https://git.eclipse.org/r/#/c/69791/ to keep the existing behavior with that setting and account for the case where there aren't visible scroll bars (which is also the case for the themed scroll bar).
Comment 23 Fabio Zadrozny CLA 2016-04-20 06:37:29 EDT
It'd be nice if this could be reviewed before M7 is out (the overview ruler is almost unusable without this fix when using the themed scroll bar).
Comment 24 Fabio Zadrozny CLA 2016-04-22 07:31:08 EDT
Note: the gerrit review also fixes:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=401230 (so, having this in should also allow https://bugs.eclipse.org/bugs/show_bug.cgi?id=424501 to be properly implemented).

As this bug has a fix, I'll close https://bugs.eclipse.org/bugs/show_bug.cgi?id=401230 as a duplicate of this one.
Comment 25 Fabio Zadrozny CLA 2016-04-22 07:31:44 EDT
*** Bug 401230 has been marked as a duplicate of this bug. ***
Comment 26 Fabio Zadrozny CLA 2016-04-22 13:18:37 EDT
Dani, do you think you can take a look at this one so that it can enter M7?
Comment 27 Dani Megert CLA 2016-04-22 15:07:43 EDT
(In reply to Fabio Zadrozny from comment #26)
> Dani, do you think you can take a look at this one so that it can enter M7?

Yes, it's on my weekend duty list.