Bug 569550

Summary: Rendering code-mining / line spacing should keep caret position unchanged.
Product: [Eclipse Project] Platform Reporter: Mickael Istria <mistria>
Component: SWTAssignee: Mickael Istria <mistria>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: Lars.Vogel, sarika.sinha
Version: 4.19   
Target Milestone: 4.19 M1   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=553849
https://git.eclipse.org/r/c/platform/eclipse.platform.text/+/173561
https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/173663
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=e0cdeb9f02df25e419adcab3555771a5670c70b3
https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/173710
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=8609014a40ef3012cdcf853223319df5a25097e3
Whiteboard:
Bug Depends on:    
Bug Blocks: 553849, 569124    

Description Mickael Istria CLA 2020-12-08 09:29:50 EST
When increasing the line height for code mining, the text area should be changed so that the caret and the current line remain at the same location. Basically, the visible area should be shifted/scrolled getLineHeight() pixels down if possible
Comment 1 Sarika Sinha CLA 2020-12-08 10:48:37 EST
(In reply to Mickael Istria from comment #0)
> When increasing the line height for code mining, the text area should be
> changed so that the caret and the current line remain at the same location.
> Basically, the visible area should be shifted/scrolled getLineHeight()
> pixels down if possible

Did not understand exactly what do you mean by shifting getLineHeight() pixels down ?
Comment 2 Mickael Istria CLA 2020-12-08 10:52:02 EST
(In reply to Sarika Sinha from comment #1)
> Did not understand exactly what do you mean by shifting getLineHeight()
> pixels down ?

Yes, I think I poorly explained it.
The idea is that we try to get the caret position fixed. So when we are in a scrollable editor and a code mining is added above the current line, we change the area by y+=lineHeight (shift lineHeight pixels down), so the final caret position is not modified, nor is the current line. Things move "around" the current line, not on the current line.
And similarly, when removing a code mining, we draw change the area to be the right amounst of pixels "higher" so the current line and caret are not perceived as moving.
Comment 3 Eclipse Genie CLA 2020-12-08 15:15:46 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.text/+/173561
Comment 4 Mickael Istria CLA 2020-12-09 17:15:25 EST
This is probably more something to handle at SWT level, when invoking StyledText.setLineVerticalIndent.
Comment 6 Mickael Istria CLA 2020-12-11 09:11:11 EST
Founds some cases where patch isn't working as expected.
Comment 7 Eclipse Genie CLA 2020-12-11 11:52:09 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/173710