With the "Enable typing in multiple selections simultaneously" option enabled (configure editor -> margins and caret -> allow multiple selections -> enable typing ...) and the cursor placed in multiple locations, bringing up code completion with ctrl-space works as intended, but the completed code only appears at the location of the active cursor.
Expected behaviour is for the completed code to be entered at every selected simultaneous typing location.
This looks a very advanced feature, right?
I don't tried this feature, but if code suggestion shows different suggestions for different multiply selections, what is the expect behavior? As I know, CC only show suggestion list for the active cursor.
Any way, can you give us a simple test case with minimal sample code and steps? Thanks.
Well when you have multiple selections, there's still one "main" active cursor, which is the last selection you made. When you autocomplete currently in multiple selection mode, the suggestion is for the active cursor as expected, and the resulting autocompleted text only appears at the location of the active cursor. The ideal behaviour would be if the same autocompleted text would appear at all cursor locations, as that is the same behaviour that you would get when typing.
Just whatever new text the autocomplete would insert, should also be inserted elsewhere in your selection.
For example, with the code:
std::list a;
std::list b;
std::list c;
If I wanted to select all three instances of "list" together, and change them all to "vector", I could box-select the three lines of [list] by holding alt and dragging a box around them, then delete them and type "vec" [ctrl-space] and select the "vector" option. However, the result is:
std::vec a;
std::vec b;
std::vec c;
std::vector d;
In this case, only the point at the active cursor is completed; the desired behaviour would be to insert the "tor" that autocomplete inserts, at all the other multiple-select cursor locations.
Obviously this is a very simplistic example, but typing in multiple selections is a huge time saver for me in more complicated code, and I often find myself having to manually type out long strings in this situation because the autocomplete doesn't function as desired.
Hi, I fully understand the expect behavior, thanks for the explanation. I just go to read the document of scintilla control which is the editor control C::B use, but I see that feature is only for "insert text in multiply caret when typing", but not for "insert text in multiply caret by program", see: Multiple Selection and Virtual Space
I see that scintilla don't have this feature, right?
This is very useful feature. Other part of it is "paste single-line text piece to many places when simultaneously (or rectangular) selection". I`m very likes it when I used UltraEdit many years ago.
I see this document:
In http://www.scintilla.org/ScintillaDoc.html, so this is the feature we want to use?
I think void CodeCompletion::DoAutocomplete(const CCToken& token, cbEditor* ed) did the actual job of insert the text, especially the code:
Yes, i presume so. Although I didn't think to mention it previously, multiple paste in the same situation would also be a very useful feature (SC_MULTIPASTE_EACH=1). It is currently possible to paste rectangular selections in place already, which is helpful, but pasting multiple instances of a single line in multiple non-rectangular selections doesn't work.
Or even better, a toggle switch in the menu under multiple selection to toggle paste behaviour and autocomplete behaviour - that way anyone can configure it to behave how they expect.
To paste some thing, you need to call, see: https://github.com/wxWidgets/wxWidgets/blob/master/samples/stc/edit.cpp
But how do we put the "itemText" to clipboard, such as:
Sorry, but I don't have a way to do this, maybe other guys can help.
Well even enabling multipaste for actual paste operations would be a good feature improvement anyway :)