When typing an opening character when the editor have a selection, I would like so enclose the selection with the opening/closing characters instead of replacing the selection with the opening character.
This text is selected
Typing "
will give this text "This text is selected"
Typing (
will give this text (This text is selected)
VS Code have this feature. And there the the original selection is retained.
This is available from Komodo Edit as Edit | Preferences... | Editor | Smart Editing | Wrap selection with type delimiter. Its implementation (using Scintilla) is open source.
It would be simpler for everybody if the editor itself supported it. But I can look there and implement it in our surroundings.
I have a simple (for single non-rectangular selection) implementation for this inside
Editor::InsertCharacter()
: https://github.com/zufuliu/notepad4/blob/main/scintilla/src/Editor.cxx#L1964See document at https://github.com/zufuliu/notepad4/wiki/Auto-Completion-in-Notepad4#auto-complete-braces-and-quotes
Thank you for the reference.
I think such a feature should be based on a setting of quote pairs. So that when typing something which it set as an open-quote for the current editor then the corresponding close-quote will be inserted at the other end of the selection. (It should become one undo-action). So if
(
is defined as an open quote with)
as the corresponding close-quote for the current editor and that editor has a selection and the use types(
then)
is also inserted as a closing (and the selection is retained).See also https://sourceforge.net/p/scintilla/feature-requests/1527/
I don't think is a goold idea。Don't compare it to VSCode, the complexity and vastness of VSCode make many people dislike it.If this feature is forced in this way, it will actually bring some difficulties to users who input pure text.