-
-
Notifications
You must be signed in to change notification settings - Fork 20.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix right click in selection of additional caret #76472
Fix right click in selection of additional caret #76472
Conversation
71389e4
to
79da505
Compare
Is there a particular reason we should only keep one of the selection and not all of them? |
In VS Code, we can copy multiselection and selections are each pasted on a different line. (edit : Done) |
Your coment made me realise that it is already the case for keyboard shortcut and therefore it would be even stranger not to do it for right click. |
Thanks to @ajreckof comments, it clearly appears that we have to keep all carets when right clicking on a selection. I've modified this PR in this way. |
79da505
to
bf7d62c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find and fix!
Couple small notes inline
bf7d62c
to
5c06c03
Compare
Thanks! |
Cherry-picked for 4.0.3. |
Fix #76417
Issue description
Right click in the selection of any secondary caret discard all selections and show context menu has is there was no selection.
Investigations
In
ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev)
multicaret is not managed when checking if click was in a selection. It only check the main caret selection. If it's outside the main caret selection, it discards all secondary caret and all selections.Fix proposal
(modified version after taking comments into account)
Managed multicarret in
ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev)
: iterate throw each caret selection to check if right click is in any of the caret selections. Keep all selection.Same modification in
void TextEdit::gui_input(const Ref<InputEvent> &p_gui_input)
: only one caret selection was checked. Iterates throw all selections and keep it all.Before
After