Setting SCI_AUTOCSETDROPRESTOFWORD(true) + SCI_SETMULTIPASTE(SC_MULTIPASTE_EACH) leads to bad autocomplete insertions. Here's how to reproduce it using SciTE source code:
wEditor.AutoCSetDropRestOfWord(false); to wEditor.AutoCSetDropRestOfWord(true); With a new build do this:
I beleive the error to be in ScintillaBase::AutoCompleteInsert and specifically this bit:
if (positionInsert - removeLen >= 0) {
positionInsert -= removeLen;
pdoc->DeleteChars(positionInsert, removeLen);
}
In the example above positionInsert at the start of this snippet which is indeed the correct position to insert (8 on Windows). But then it subtracts removeLen (5) so that it finally deletes 5 characters starting at position 3 which is in the first line. Without the substraction it works as expected.
If SC_MULTIPASTE_EACH is off on then a different code path is used which does not to the substraction and it works fine.
If DropRestOfWord is off then removeLen equals 0 and it also works fine.
Actually positionInsert is only the correct position to insert if the caret is at the start of the line. I'm not sure what the correct fix would be. I suppose the code should investigate the word each selection is on to be able to find the correct insertposition and removeLen.
This is referring to
SCI_AUTOCSETMULTI(SC_MULTIAUTOC_EACH)instead ofSCI_SETMULTIPASTE(SC_MULTIPASTE_EACH).The relevant change sets for this are [bd09a9] and [b8fc27].
Related
Commit: [b8fc27]
Commit: [bd09a9]