Bug 579270 - [Multiple carets] Provide support for multiple carets in JavaEditor
Summary: [Multiple carets] Provide support for multiple carets in JavaEditor
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.23   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: ui
Depends on:
Blocks:
 
Reported: 2022-03-15 13:10 EDT by Dirk Steinkamp CLA
Modified: 2024-03-06 16:11 EST (History)
2 users (show)

See Also:


Attachments
Multiple carets with NavigateNextSubWordAction in JavaEditor (414.87 KB, image/gif)
2022-03-16 19:34 EDT, Dirk Steinkamp CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Steinkamp CLA 2022-03-15 13:10:06 EDT
From https://bugs.eclipse.org/bugs/show_bug.cgi?id=574942#c6:

> - JavaEditor: make JavaEditor aware of multiple carets, and implement
> support accordingly.

From https://bugs.eclipse.org/bugs/show_bug.cgi?id=574942#c4:

> List of some other text editing/selection commands that don't respect the multi selection either and mostly reset it to a single selection:
> - Select next word: Ctrl+Shift+Right
> - Select previous word: Ctrl+Shift+Left
> - Select next element: Alt+Shift+Left
> - Select previous element: Alt+Shift+Right
> - Delete next word: Ctrl+Del
> - Delete previous word: Ctrl+Backspace
> - Delete to end of line: Ctrl+Shift+Del
> - Delete to beginning of line: no default shortcut

> Maybe out of scope:
> - Select enclosing element: Alt+Shift+Up
> - Restore last selection: Alt+Shift+Down

There's currently some activity to expand support for multiple carets / multiple selections in text editors. While JavaEditor can make use of some multi-caret-features provided by StyledText, it also has many specifics that override the default behaviour because of special support for the Java syntax, word-boundaries in camelCaseIdentifiers, etc.

The entry point for enabling general multi-caret seems to be the class JavaEditor, which defines many special actions related to the details from the other issue above: https://git.eclipse.org/r/plugins/gitiles/jdt/eclipse.jdt.ui/+/refs/heads/master/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java

To support multi-carets these actions need to be expanded to make use of the multi-caret-features.
Comment 1 Dirk Steinkamp CLA 2022-03-16 19:34:21 EDT
Created attachment 288227 [details]
Multiple carets with NavigateNextSubWordAction in JavaEditor

Early experiments with the JavaEditor show how navigating with sub word matches looks with multiple carets. :-)

Could someone give me a little background info about modelOffset2WidgetOffset()? Is this related to e.g. code folding?

I noticed occasionally some strange behavior when selecting with the new commands/keyboard shortcuts, and I guess that might be the reason.
Comment 2 Eclipse Genie CLA 2024-03-06 16:11:16 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.