There seems to be a problem when using SCI_AUTOCSETMULTI(SC_MULTIAUTOC_EACH) and SCI_AUTOCSETDROPRESTOFWORD(TRUE) leading to an unexpected autocompletion behavior with single caret. For more information, see https://github.com/geany/geany/issues/4373
On vacation till mid September and can't investigate without a PC.
See https://sourceforge.net/p/scintilla/bugs/2445/ which is about the same problem (even though the title says MULTIPASTE), and has some more info.
SC_MULTIAUTOC_EACHwas a contribution from Mitchell Foral and was likely only designed for some circumstances. Fixing this does not appear simple to me so I'll likely not attempt to do so myself.There are multiple sub-problems here. "Drop rest of word" needs to know how long the word is at each selection but only determines the word end and thus word length at the primary selection. Could pass the option through to
AutoCompleteInsertand calculate for each selection. Secondly, the first argument toAutoCompleteInsertisn't the selection position but offset from it by the start length (commonly number of characters in word before caret) so each selection should offset by this amount but there will be further problems if different words or positions within words are selected.There are 3 calls to
AutoCompleteInsert- the common case insideAutoCompleteCompletedand 2 more for automatic choice when list only contains one choice. Any change should also work for 'choose single'.An ugly fix for just the reported problem is to coerce
multiAutoCModetoOncewhen there is only one selection.Thanks Neil, I think the easiest "fix" for Geany will be to stop using SC_MULTIAUTOC_EACH.