Bug 536207 - Minimap wrong height calculation
Summary: Minimap wrong height calculation
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.9   Edit
Hardware: All Windows 10
: P3 minor (vote)
Target Milestone: 4.9 RC1   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-23 08:41 EDT by Michael Keppler CLA
Modified: 2018-08-24 07:49 EDT (History)
5 users (show)

See Also:


Attachments
screenshot (116.29 KB, image/png)
2018-06-23 08:41 EDT, Michael Keppler CLA
no flags Details
Minimap bug (149.63 KB, image/gif)
2018-07-04 09:05 EDT, Angelo ZERR CLA
no flags Details
Issue with patchset 3 on mac (445.60 KB, image/png)
2018-07-26 04:54 EDT, Matthias Becker CLA
no flags Details
iss# (310.43 KB, image/png)
2018-07-26 04:55 EDT, Matthias Becker CLA
no flags Details
my test file to reproduce issues reported for patchset 3 (7.05 KB, text/plain)
2018-07-26 04:56 EDT, Matthias Becker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Keppler CLA 2018-06-23 08:41:09 EDT
Created attachment 274593 [details]
screenshot

The minimap rectangle selection does not show the same content as the editor and is off by several lines. See the attached screenshot.

This is because both the minimap rectangle height as well as the font size are calculated by multiplying the original editor height and font size by 0.2. But the text with 0.2 times font size does NOT automatically have exactly 0.2 times the height.

Therefore the better way for calculating the height of the minimap rectangle would be:
* get the number of visible lines N in the editor
* calculate the height of N lines of text in the minimap text widget via SWT methods, font metrics or similar
Comment 1 Eclipse Genie CLA 2018-07-03 11:52:30 EDT
New Gerrit change created: https://git.eclipse.org/r/125410
Comment 2 Angelo ZERR CLA 2018-07-04 09:05:20 EDT
Created attachment 274814 [details]
Minimap bug

Here a demo which shows you the bug when your editor has few lines.
Comment 3 Matthias Becker CLA 2018-07-26 04:54:56 EDT
Created attachment 275138 [details]
Issue with patchset 3 on mac
Comment 4 Matthias Becker CLA 2018-07-26 04:55:07 EDT
Created attachment 275139 [details]
iss#
Comment 5 Matthias Becker CLA 2018-07-26 04:56:10 EDT
Comment on attachment 275139 [details]
iss#

issue with patchset 3 on mac and word wrap active
Comment 6 Matthias Becker CLA 2018-07-26 04:56:59 EDT
Created attachment 275140 [details]
my test file to reproduce issues reported for patchset 3
Comment 7 Angelo ZERR CLA 2018-07-26 06:12:39 EDT
I have the same issue with Windows OS.
Comment 8 Angelo ZERR CLA 2018-07-26 06:13:29 EDT
I have the same issue with Windows OS with or without word wrap.
Comment 9 Matthias Becker CLA 2018-08-02 02:38:29 EDT
I think this issue really should be fixed before we ship it with 2018-09 to our customers. In this state the feature really doesn't make a good impression.
Comment 10 Eclipse Genie CLA 2018-08-02 06:39:11 EDT
New Gerrit change created: https://git.eclipse.org/r/126950
Comment 11 Arne Deutsch CLA 2018-08-02 06:41:23 EDT
I have commited an alternative implementation for the calculation of the height. I use the same approach to calculate the end of the window as it was used already for the start as this seems to be accurate in all circumstances. Have tested it under windows 10. Works well with and without word wrap enabled.
Comment 12 Angelo ZERR CLA 2018-08-02 06:48:57 EDT
Thanks @Arne! I will test your gerrit patch. IMHO I think we should add too a test for this issue to complete tests that I have written at https://git.eclipse.org/r/#/c/126948/ (need a review)
Comment 13 Till Brychcy CLA 2018-08-02 07:18:08 EDT
(In reply to Arne Deutsch from comment #11)
> I have commited an alternative implementation for the calculation of the
> height. I use the same approach to calculate the end of the window as it was
> used already for the start as this seems to be accurate in all
> circumstances. Have tested it under windows 10. Works well with and without
> word wrap enabled.

I've tried it. I see two issues:
- On the Mac, the last line seems to be not included (Possible solution: See gerrit)
- If the text is shorter than the displayed area, the box is too small (and also not updated, if lines are added)
Comment 14 Matthias Becker CLA 2018-08-02 07:23:08 EDT
(In reply to Angelo ZERR from comment #12)
> Thanks @Arne! I will test your gerrit patch. IMHO I think we should add too
> a test for this issue to complete tests that I have written at
> https://git.eclipse.org/r/#/c/126948/ (need a review)

+1 for a test.
I also left some comments in gerrit.
Comment 15 Arne Deutsch CLA 2018-08-02 09:59:25 EDT
I have fixed the behaviour according to your comments. But I fear the adding tests would require a major refactoring beforehand. Right now all calculations and the result are hidden inside the render logic. To write tests against this one would need to seperate the calculations from the render logic into a seperate class.
Comment 16 Angelo ZERR CLA 2018-08-02 10:02:01 EDT
> To write tests against this one would need to seperate the calculations from the render logic into a seperate class.

Please do that!
Comment 17 Matthias Becker CLA 2018-08-02 10:11:52 EDT
(In reply to Angelo ZERR from comment #16)
> > To write tests against this one would need to seperate the calculations from the render logic into a seperate class.
> 
> Please do that!

should we separate this into a new commit or do you want to do it in the current commit?
Comment 18 Angelo ZERR CLA 2018-08-02 10:16:14 EDT
> should we separate this into a new commit or do you want to do it in the current commit?

I think in the same commit is better.
Comment 19 Arne Deutsch CLA 2018-08-03 09:33:11 EDT
I have started to refactor MinimapWidget but it is really a lot of work. I can not invest that much time to make the code clean and testable. I would suggest to take the fix as it is now. If you relly want to refactor the class to make it testable and add tests I would suggest to create a different ticket for that.
Comment 20 Till Brychcy CLA 2018-08-03 10:06:28 EDT
(In reply to Arne Deutsch from comment #19)
> I have started to refactor MinimapWidget but it is really a lot of work. I
> can not invest that much time to make the code clean and testable. I would
> suggest to take the fix as it is now. If you relly want to refactor the
> class to make it testable and add tests I would suggest to create a
> different ticket for that.

Have you seen the issue in the gerrit regarding switching open editors in a restarted eclipse?
Comment 21 Arne Deutsch CLA 2018-08-03 10:18:00 EDT
Yes, but can not reproduce it at my machine. Appart from this I think the original bug has been already fixed. Together with some others that we have found during the process. I think it makes sense to create a new bug ticket for that specific issue. Would you do that?
Comment 22 Till Brychcy CLA 2018-08-03 10:28:28 EDT
(In reply to Arne Deutsch from comment #21)
> Yes, but can not reproduce it at my machine. Appart from this I think the
> original bug has been already fixed. Together with some others that we have
> found during the process. I think it makes sense to create a new bug ticket
> for that specific issue. Would you do that?
This issue doesn’t appear without your patch so i‘d say it belongs to this bug. 
Can someone with a Mac please try to reproduce this?
Comment 23 Matthias Becker CLA 2018-08-03 10:41:34 EDT
(In reply to Till Brychcy from comment #22)
> (In reply to Arne Deutsch from comment #21)
> > Yes, but can not reproduce it at my machine. Appart from this I think the
> > original bug has been already fixed. Together with some others that we have
> > found during the process. I think it makes sense to create a new bug ticket
> > for that specific issue. Would you do that?
> This issue doesn’t appear without your patch so i‘d say it belongs to this
> bug. 
> Can someone with a Mac please try to reproduce this?

I tried. I could not. But maybe I did not get your description correctly. I started a target IDE from my DevIDE and restarted this. Box height looked correct.
Can you explain your steps in more details or do a screen recording?
Comment 24 Till Brychcy CLA 2018-08-03 11:18:51 EDT
(In reply to Matthias Becker from comment #23)
> (In reply to Till Brychcy from comment #22)
> > (In reply to Arne Deutsch from comment #21)
> > > Yes, but can not reproduce it at my machine. Appart from this I think the
> > > original bug has been already fixed. Together with some others that we have
> > > found during the process. I think it makes sense to create a new bug ticket
> > > for that specific issue. Would you do that?
> > This issue doesn’t appear without your patch so i‘d say it belongs to this
> > bug. 
> > Can someone with a Mac please try to reproduce this?
> 
> I tried. I could not. But maybe I did not get your description correctly. I
> started a target IDE from my DevIDE and restarted this. Box height looked
> correct.
> Can you explain your steps in more details or do a screen recording?

I tried a bit and with some editor configurations it doesn't happen.

I general I have multiple .java files open (some of them short) plus a .classpath plus a pom.xml

I'll try to find to make it reproducible over the weekend.
Comment 25 Till Brychcy CLA 2018-08-07 04:33:51 EDT
I have tried to make it reproducible click-by-click starting from a fresh workspace, but failed.

But it happens more often, if I start in a workspace that has a lot of editors open.

I don't know if you should just commit the change as is and wait if somebody figures out how to reproduce this.
Comment 26 Matthias Becker CLA 2018-08-07 06:45:24 EDT
(In reply to Till Brychcy from comment #25)
> I don't know if you should just commit the change as is and wait if somebody
> figures out how to reproduce this.

The question is: Is the state with this change better then the current state in master?

I would say "yes" because the mini map currently is wrong for (almost) all cases.
What do you think?
Comment 27 Till Brychcy CLA 2018-08-07 06:48:30 EDT
(In reply to Matthias Becker from comment #26)
> (In reply to Till Brychcy from comment #25)
> > I don't know if you should just commit the change as is and wait if somebody
> > figures out how to reproduce this.
> 
> The question is: Is the state with this change better then the current state
> in master?
> 
> I would say "yes" because the mini map currently is wrong for (almost) all
> cases.
> What do you think?

Yes, even if it more obviously broken if the restart-problem does appear.
Comment 28 Matthias Becker CLA 2018-08-14 07:17:28 EDT
(In reply to Till Brychcy from comment #27)
> (In reply to Matthias Becker from comment #26)
> > (In reply to Till Brychcy from comment #25)
> > > I don't know if you should just commit the change as is and wait if somebody
> > > figures out how to reproduce this.
> > 
> > The question is: Is the state with this change better then the current state
> > in master?
> > 
> > I would say "yes" because the mini map currently is wrong for (almost) all
> > cases.
> > What do you think?
> 
> Yes, even if it more obviously broken if the restart-problem does appear.

So what do we do? Merge this fix or not?
Comment 29 Till Brychcy CLA 2018-08-14 09:09:29 EDT
(In reply to Matthias Becker from comment #28)
> (In reply to Till Brychcy from comment #27)
> > (In reply to Matthias Becker from comment #26)
> > > (In reply to Till Brychcy from comment #25)
> > > > I don't know if you should just commit the change as is and wait if somebody
> > > > figures out how to reproduce this.
> > > 
> > > The question is: Is the state with this change better then the current state
> > > in master?
> > > 
> > > I would say "yes" because the mini map currently is wrong for (almost) all
> > > cases.
> > > What do you think?
> > 
> > Yes, even if it more obviously broken if the restart-problem does appear.
> 
> So what do we do? Merge this fix or not?

I think we should merge
Comment 31 Matthias Becker CLA 2018-08-14 10:04:13 EDT
Thank you Arne for the fix.
Comment 32 Matthias Becker CLA 2018-08-14 10:05:36 EDT
(In reply to Till Brychcy from comment #24)
> (In reply to Matthias Becker from comment #23)
> > (In reply to Till Brychcy from comment #22)
> > > (In reply to Arne Deutsch from comment #21)
> > > > Yes, but can not reproduce it at my machine. Appart from this I think the
> > > > original bug has been already fixed. Together with some others that we have
> > > > found during the process. I think it makes sense to create a new bug ticket
> > > > for that specific issue. Would you do that?
> > > This issue doesn’t appear without your patch so i‘d say it belongs to this
> > > bug. 
> > > Can someone with a Mac please try to reproduce this?
> > 
> > I tried. I could not. But maybe I did not get your description correctly. I
> > started a target IDE from my DevIDE and restarted this. Box height looked
> > correct.
> > Can you explain your steps in more details or do a screen recording?
> 
> I tried a bit and with some editor configurations it doesn't happen.
> 
> I general I have multiple .java files open (some of them short) plus a
> .classpath plus a pom.xml
> 
> I'll try to find to make it reproducible over the weekend.

Should we keep this bug open for this issue or do you want to create a separate bug?
Comment 33 Eclipse Genie CLA 2018-08-20 12:19:41 EDT
New Gerrit change created: https://git.eclipse.org/r/127719
Comment 34 Angelo ZERR CLA 2018-08-20 12:21:53 EDT
> Have you seen the issue in the gerrit regarding switching open editors in a restarted eclipse?

I can reproduce the problem. Please review my simple gerrit patch at https://git.eclipse.org/r/#/c/127719/ 

Please note the outline does that too.
Comment 35 Matthias Becker CLA 2018-08-24 06:30:42 EDT
(In reply to Angelo ZERR from comment #34)
> > Have you seen the issue in the gerrit regarding switching open editors in a restarted eclipse?
> 
> I can reproduce the problem. Please review my simple gerrit patch at
> https://git.eclipse.org/r/#/c/127719/ 
> 
> Please note the outline does that too.

the fix looks good to me. Can we / are we allowed to merge it into RC1?
Comment 36 Dani Megert CLA 2018-08-24 06:53:37 EDT
(In reply to Matthias Becker from comment #35)
> (In reply to Angelo ZERR from comment #34)
> > > Have you seen the issue in the gerrit regarding switching open editors in a restarted eclipse?
> > 
> > I can reproduce the problem. Please review my simple gerrit patch at
> > https://git.eclipse.org/r/#/c/127719/ 
> > 
> > Please note the outline does that too.
> 
> the fix looks good to me. Can we / are we allowed to merge it into RC1?

Yes.
Comment 37 Matthias Becker CLA 2018-08-24 07:00:35 EDT
(In reply to Dani Megert from comment #36)
> (In reply to Matthias Becker from comment #35)
> > (In reply to Angelo ZERR from comment #34)
> > > > Have you seen the issue in the gerrit regarding switching open editors in a restarted eclipse?
> > > 
> > > I can reproduce the problem. Please review my simple gerrit patch at
> > > https://git.eclipse.org/r/#/c/127719/ 
> > > 
> > > Please note the outline does that too.
> > 
> > the fix looks good to me. Can we / are we allowed to merge it into RC1?
> 
> Yes.

So then I merge it today.
Comment 39 Matthias Becker CLA 2018-08-24 07:39:47 EDT
(In reply to Angelo ZERR from comment #34)
> > Have you seen the issue in the gerrit regarding switching open editors in a restarted eclipse?
> 
> I can reproduce the problem. Please review my simple gerrit patch at
> https://git.eclipse.org/r/#/c/127719/ 
> 
> Please note the outline does that too.

Just merged it. Thank you Angelo for the fix.
Comment 40 Angelo ZERR CLA 2018-08-24 07:49:05 EDT
> Just merged it. Thank you Angelo for the fix.

You are welcome!