Community
Participate
Working Groups
Build Identifier: Version: Indigo Service Release 1 Build id: 20110916-0149 Looks like the reason of the bug is trivial: the top margin in StyledText#getVisualLineIndex is added twice: int getVisualLineIndex(TextLayout layout, int offsetInLine) { int lineIndex = layout.getLineIndex(offsetInLine); int[] offsets = layout.getLineOffsets(); if (lineIndex != 0 && offsetInLine == offsets[lineIndex]) { int lineY = layout.getLineBounds(lineIndex).y; int caretY = getCaret().getLocation().y - topMargin - getLinePixel(getCaretLine()); if (lineY > caretY) lineIndex--; caretAlignment = OFFSET_LEADING; } return lineIndex; } topMargin is explicitly subtracted, but it is already included in value calculated by getLinePixel. The line should look like: int caretY = getCaret().getLocation().y - getLinePixel(getCaretLine()); Reproducible: Always Steps to Reproduce: 1. Run the following snippet: public class Snippet { static String text = "Line One. Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\n" + "Line Two.\n" + "Line Three"; public static void main(final String [] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final StyledText styledText = new StyledText(shell, SWT.MULTI | SWT.WRAP | SWT.BORDER); styledText.setMargins(5, 5, 5, 5); styledText.setWordWrap(true); styledText.setText(text); shell.setSize(300, 400); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } } 2. Press ARROW DOWN several times 3. Notice that UP/DOWN keys are no more working
Thank you very much for the bug report and patch http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=663ad5c7f54209a8b60ed32a953bece16acebea0
Can I ask to backport the fix to 3.7.2 ?
Silenio: 3.7.2 backport requested, is there still time ?
Sorry no, 3.7.2 SR3 is Monday.
*** Bug 319131 has been marked as a duplicate of this bug. ***