Community
Participate
Working Groups
See bug Bug 466532 for initial story. In order to support multiple selection in Text Editors, we first need the SWT StyledText to properly deal with multiple selections. A patch already adds API and code for it: https://git.eclipse.org/r/#/c/154419/ . however, there are still some glitches to deal with before this can be released. Specific issues are added as "Depends on".
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/154419 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=398bbd8af1b74bbc8f14d6035a44331b0cdeef79
(In reply to Eclipse Genie from comment #1) > Gerrit change > https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/154419 was > merged to [master]. > Commit: > http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/ > ?id=398bbd8af1b74bbc8f14d6035a44331b0cdeef79 Thanks Mickael for this enhancement. Please plan to add an N&N entry for this.
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/182701
Gerrit change https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/182701 was merged to [master]. Commit: http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/?id=4189ddf7ee61b0d1afb1f110988631c967517f21
The latest changes probably caused some regression or uncovered previously hidden issue. I've got exception below originating from changed code (StyledText.updateCaretVisibility()) while selecting different files of a commit in git history view, where the diff should be shown: java.lang.ArrayIndexOutOfBoundsException: Index 32 out of bounds for length 32 at org.eclipse.swt.custom.StyledTextRenderer.getLineSize(StyledTextRenderer.java:312) at org.eclipse.swt.custom.StyledTextRenderer.getLineHeight(StyledTextRenderer.java:676) at org.eclipse.swt.custom.StyledTextRenderer.getLineHeight(StyledTextRenderer.java:673) at org.eclipse.swt.custom.StyledText.getLineIndex(StyledText.java:4414) at org.eclipse.swt.custom.StyledText.getPartialBottomIndex(StyledText.java:4730) at org.eclipse.swt.custom.StyledText.redraw(StyledText.java:7769) at org.eclipse.swt.custom.StyledText.updateCaretVisibility(StyledText.java:11201) at org.eclipse.swt.custom.StyledText.setCaretLocations(StyledText.java:8978) at org.eclipse.swt.custom.StyledText.setCaretLocations(StyledText.java:8872) at org.eclipse.swt.custom.StyledText.setCaretOffsets(StyledText.java:9027) at org.eclipse.swt.custom.StyledText.reset(StyledText.java:8222) at org.eclipse.swt.custom.StyledText.setContent(StyledText.java:9089) at org.eclipse.jface.text.TextViewer.initializeWidgetContents(TextViewer.java:3374) at org.eclipse.jface.text.TextViewer.setVisibleDocument(TextViewer.java:3416) at org.eclipse.jface.text.source.projection.ProjectionViewer.setVisibleDocument(ProjectionViewer.java:694) at org.eclipse.jface.text.TextViewer.setDocument(TextViewer.java:2805) at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:663) at org.eclipse.jface.text.source.projection.ProjectionViewer.setDocument(ProjectionViewer.java:368) at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:603) at org.eclipse.egit.ui.internal.history.GitHistoryPage$9$1.runInUIThread(GitHistoryPage.java:2832)
Thanks Andrey. Can you please provide some more details about how to reproduce the issue? An example of a Git repo to use, and a commit and file to look at in history would be welcome.
(In reply to Mickael Istria from comment #6) > Thanks Andrey. > Can you please provide some more details about how to reproduce the issue? > An example of a Git repo to use, and a commit and file to look at in history > would be welcome. Sorry, I've checked few commits / files, and didn't noticed which one was it.
(In reply to Andrey Loskutov from comment #7) > Sorry, I've checked few commits / files, and didn't noticed which one was it. OK. Do you remember about the repository? Also, do I get it right that the failing widget seems to be the commit viewer on the left pane of the "Git History" view?
Created attachment 286721 [details] Steps to run into error (In reply to Mickael Istria from comment #8) > (In reply to Andrey Loskutov from comment #7) > > Sorry, I've checked few commits / files, and didn't noticed which one was it. > > OK. Do you remember about the repository? > Also, do I get it right that the failing widget seems to be the commit > viewer on the left pane of the "Git History" view? OK, I've tried to force the error and it seem to be easy: Just select commit 398bbd8af1b74bbc8f14d6035a44331b0cdeef79 (for this bug) in the history view (originally I was in JDT core on one of not yet pushed patches). Click on a file in the files section on the right side. Scroll to the diff section on the left side. Select some text there. Click on the next file on the right side. Kaboom.
Note, I'm using latest SDK & EGit nightly builds available today.
BTW, the SWT error marker in my video is the API tooling error: List of compatible changes: - The non-abstract method org.eclipse.swt.custom.StyledText. setSelectionRanges(int[]) has been added Please fix that too.
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182737
(In reply to Andrey Loskutov from comment #9) > Just select commit 398bbd8af1b74bbc8f14d6035a44331b0cdeef79 (for this bug) > in the history view (originally I was in JDT core on one of not yet pushed > patches). > > Click on a file in the files section on the right side. > Scroll to the diff section on the left side. > Select some text there. > Click on the next file on the right side. > Kaboom. Thanks, I can easily reproduce. I was missng the part about selecting text. I'll fix it next week.
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt.binaries/+/182744
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182737 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=b6a81a382c8438ebce01fa0b4c391b374ac64b5e
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.swt.binaries/+/182744 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.binaries.git/commit/?id=06697b2e2ba3cb5a853281574e70492dae74fd2e
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182760
Here is another related stack I've found today in the log, looks like "Java Stack Trace" console is affected too (in this case that was a "paste" into the console): Caused by: java.lang.IllegalArgumentException: Index out of bounds at org.eclipse.swt.SWT.error(SWT.java:4874) at org.eclipse.swt.SWT.error(SWT.java:4808) at org.eclipse.swt.SWT.error(SWT.java:4779) at org.eclipse.swt.graphics.TextLayout._getOffset(TextLayout.java:1196) at org.eclipse.swt.graphics.TextLayout.getPreviousOffset(TextLayout.java:1401) at org.eclipse.swt.custom.StyledText.getPointAtOffset(StyledText.java:5686) at java.base/java.util.stream.IntPipeline$1$1.accept(IntPipeline.java:180) at java.base/java.util.Spliterators$IntArraySpliterator.forEachRemaining(Spliterators.java:1032) at java.base/java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:699) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:550) at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:517) at org.eclipse.swt.custom.StyledText.setCaretLocations(StyledText.java:8871) at org.eclipse.swt.custom.StyledText.showCaret(StyledText.java:11132) at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7596) at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:8464) at org.eclipse.swt.custom.StyledText.paste(StyledText.java:7654) at org.eclipse.jface.text.TextViewer.paste(TextViewer.java:3932) at org.eclipse.jface.text.TextViewer.doOperation(TextViewer.java:3863) at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:1064) at org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceConsoleViewer.doOperation(JavaStackTraceConsoleViewer.java:70) at org.eclipse.ui.console.actions.TextViewerAction.run(TextViewerAction.java:71) at org.eclipse.jface.action.Action.runWithEvent(Action.java:474) at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:121) ... 55 more
(In reply to Andrey Loskutov from comment #9) > Just select commit 398bbd8af1b74bbc8f14d6035a44331b0cdeef79 (for this bug) > in the history view (originally I was in JDT core on one of not yet pushed > patches). > > Click on a file in the files section on the right side. > Scroll to the diff section on the left side. > Select some text there. > Click on the next file on the right side. > Kaboom. This one should be tested/fixed with https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182760 (to be merged soon, after code freeze probably) (In reply to Andrey Loskutov from comment #18) > Caused by: java.lang.IllegalArgumentException: Index out of bounds > at org.eclipse.swt.SWT.error(SWT.java:4874) > at org.eclipse.swt.SWT.error(SWT.java:4808) > at org.eclipse.swt.SWT.error(SWT.java:4779) > at org.eclipse.swt.graphics.TextLayout._getOffset(TextLayout.java:1196) > at > org.eclipse.swt.graphics.TextLayout.getPreviousOffset(TextLayout.java:1401) > at org.eclipse.swt.custom.StyledText.getPointAtOffset(StyledText.java:5686) > at java.base/java.util.stream.IntPipeline$1$1.accept(IntPipeline.java:180) > at > java.base/java.util.Spliterators$IntArraySpliterator. > forEachRemaining(Spliterators.java:1032) > at > java.base/java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:699) > at > java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java: > 484) > at > java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline. > java:474) > at > java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java: > 550) > at > java.base/java.util.stream.AbstractPipeline. > evaluateToArrayNode(AbstractPipeline.java:260) > at > java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java: > 517) > at org.eclipse.swt.custom.StyledText.setCaretLocations(StyledText.java:8871) > at org.eclipse.swt.custom.StyledText.showCaret(StyledText.java:11132) > at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7596) > at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:8464) > at org.eclipse.swt.custom.StyledText.paste(StyledText.java:7654) > at org.eclipse.jface.text.TextViewer.paste(TextViewer.java:3932) > at org.eclipse.jface.text.TextViewer.doOperation(TextViewer.java:3863) > at > org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java: > 1064) > at > org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceConsoleViewer. > doOperation(JavaStackTraceConsoleViewer.java:70) > at > org.eclipse.ui.console.actions.TextViewerAction.run(TextViewerAction.java:71) > at org.eclipse.jface.action.Action.runWithEvent(Action.java:474) > at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:121) > ... 55 more This one I couldn't reproduce. Any precondition you have in mind? Or some steps to reproduce?
(In reply to Mickael Istria from comment #19) > This one should be tested/fixed with > https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182760 (to be > merged soon, after code freeze probably) Why not for M1? This is quite a regression. > This one I couldn't reproduce. Any precondition you have in mind? Or some > steps to reproduce? No. Try to play with pasting stack traces and "Format" - that is what I use all the time.
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182760 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=21d57191cc165ad90335f4e4c2a8e0f87531794a
Created attachment 286744 [details] Broken selection ranges I see another big issue: text selection ranges (start & end) are now changed during mouse moving. Click anywhere in the code and start to select text while holding left mouse button. It can easily happen that start selection offset will change during this, resulting in selection containing completely unrelated text. This must be fixed!
(In reply to Andrey Loskutov from comment #22) > Created attachment 286744 [details] > Broken selection ranges > > I see another big issue: text selection ranges (start & end) are now changed > during mouse moving. > > Click anywhere in the code and start to select text while holding left mouse > button. It can easily happen that start selection offset will change during > this, resulting in selection containing completely unrelated text. Thanks for the report and video. I can reproduce it, this is indeed a regression caused by the multi-selection support. Some piece of code that takes care of keeping track of whether caret is at the beginning or end of the selection seems broken. I'm looking at it.
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182855
(In reply to Mickael Istria from comment #23) > Thanks for the report and video. > I can reproduce it, this is indeed a regression caused by the > multi-selection support. Some piece of code that takes care of keeping track > of whether caret is at the beginning or end of the selection seems broken. > I'm looking at it. Mickael, any update? Selecting code is a pain now, I (with my trackball) permanently manage to select more then one line now while selecting *one* line with the mouse...
(In reply to Andrey Loskutov from comment #25) > (In reply to Mickael Istria from comment #23) > Mickael, any update? Yes, I managed to capture the bug in an automated test (see last Gerrit). I think I'll be able to submit a good fix soon, but cannot really commit I'll have it ready before end of week. > Selecting code is a pain now, I (with my trackball) > permanently manage to select more then one line now while selecting *one* > line with the mouse... It's not only with mouse, it can be reproduced with keyboard, or even API, It's really the selection modification that seems tp have lost the check for left-to-right/right-to-left to decide which end of the range must stay.
@Mickael, Can we revert this for M1?
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182914
(In reply to Sarika Sinha from comment #27) > @Mickael, > Can we revert this for M1? The revert patch is: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182914
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182914 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=8fd972c2216766cfdb9c305d21f193ebb3b0a9f9
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/182528
Gerrit change https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/182528 was merged to [master]. Commit: http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/?id=cac0f0d9ba9d0faf2a87ba4449e57583bcc64e92
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/182529
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182855 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=5092309ecf8c622ae85813105b84ee705cc8f9a7
Gerrit change https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/182529 was merged to [master]. Commit: http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/?id=bfd87ef647a66f11f2ff7ccaf66416440f4441d5
All known regressions seem to be fixed.
This change introduced a regression: the caret column does not persist when it is moved from the end of a long line to a short one and back again. ** Steps to reproduce ** Open a text editor (I reproduced it in the java editor). Enter the following text: a very very very long line a short line Position the caret at the end of line 1, press "cursor down", then "cursor up" on your keyboard. ** Observed behavior ** The caret is now in the middle of line 1. ** Expected behavior ** The caret should be at the end of line 1. This was the behavior before this change, which was accomplished by storing the previous caret position in "StyledText.columnX". However, with this change, columnX is no longer read in https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/bundles/org.eclipse.swt/Eclipse%20SWT%20Custom%20Widgets/common/org/eclipse/swt/custom/StyledText.java?id=4e0d3cef45c6b6512666f9d51e8154ed545bc57b#n2701 nor in https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/bundles/org.eclipse.swt/Eclipse%20SWT%20Custom%20Widgets/common/org/eclipse/swt/custom/StyledText.java?id=4e0d3cef45c6b6512666f9d51e8154ed545bc57b#n2805 Should I create a new bug for this regression?
(In reply to ChristophK from comment #37) > Should I create a new bug for this regression? Yes please.