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

Bug 570208

Summary: Rendering/Scroll issue with vertical indent
Product: [Eclipse Project] Platform Reporter: Mickael Istria <mistria>
Component: SWTAssignee: Mickael Istria <mistria>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: ericwill
Version: 4.19   
Target Milestone: 4.19 M3   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/174599
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=44d171c4d147e7c175dcc3a3fdea966dc7c5de44
https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/174709
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=da8340bb75569958e631ae94641994c1804c8d69
Whiteboard:
Bug Depends on: 570342    
Bug Blocks:    

Description Mickael Istria CLA 2021-01-08 15:16:09 EST
As a regression after changes for bug 569626 and bug 569550, code minings sometimes created rendering/visible area errors on the text editor.
The symptom is usually that one cannot scroll to the actual top of the file because some empty space is added to the top of the visible area.
It seems to happen whenever a code mining is shows on the few first lines of the file and when scrolling down.
Comment 1 Mickael Istria CLA 2021-01-08 15:35:11 EST
I can reproduce it with plain SWT:

public class Snippet378 {

	private static final int LINES = 50;
	private static final int WORDS_PER_LINE = 10;
	private static final String WORD = "123456789 ";

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setBounds(10, 10, 300, 300);
		shell.setLayout(new FillLayout());
		final StyledText text = new StyledText(shell, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);

		StringBuilder buffer = new StringBuilder(LINES * WORDS_PER_LINE * WORD.length() * 2);
		for (int i = 0; i < LINES ; i++) {
			buffer.append("Line " + i + ": ");
			for (int j = 0; j < WORDS_PER_LINE; j++) {
				buffer.append(WORD);
			}
			buffer.append("\n");
		}

		shell.open();
		text.setText(buffer.toString());
		text.addCaretListener(e -> {
			if (text.getCaretOffset() > 100) {
				text.setLineVerticalIndent(1, 25);
			}
		});

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}

Just scroll down, click on any character (with offset > 100), then try to scroll up => some text is not accessible any more. Resizing seems to help.
Comment 2 Mickael Istria CLA 2021-01-11 05:39:58 EST
I have this issue reproduced into a SWT unit test. It's related to topIndex not being update so scrolling up scrolls above expected area.
Comment 3 Eclipse Genie CLA 2021-01-11 05:54:52 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/174599
Comment 5 Mickael Istria CLA 2021-01-12 10:01:23 EST
Some part of the issue is still present despite previous change.
It seems related to scrollbars not being properly updates in some cases, and then able to scroll above 1st line, cascading to many issues.
Comment 6 Eclipse Genie CLA 2021-01-12 16:18:44 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/174709
Comment 8 Mickael Istria CLA 2021-01-14 15:46:43 EST
I'm marking is as resolved as last known issue (bug 570342) seems fixed. Anyone feel free to reopen if further issues are identified.
Comment 9 Mickael Istria CLA 2021-02-10 03:02:44 EST
*** Bug 542107 has been marked as a duplicate of this bug. ***