I am struggling to understand the intention of some code in

Autocomplete::Select(const char *word)

My wordlist contains:

"view ViewColour ViewFind ViewKind ViewLink ViewList ViewStandard ViewTrigger 
ViewUseColour"

const char *word points at "vie" and ignoreCase is set to true.

The problem is that the initially selected word in the auto-completion list 
is "ViewColour", even though I have specifically stated that I am ignoring 
case. This is very annoying, as you attempt to autocomplete and get the wrong 
word from the list. I can fix this by changing the list to "View 
ViewColour...", but it seems odd that I should be compelled to do this. (And it 
may not always be possible as it depends on the casing rules that the author of 
the target language code wants followed - and it forces me to insert "View" 
when I would really have preferred to insert "view").

The problem is caused by this code towards the end of the routine (3 leading 
tabs removed to reduce line wrapping):

if (ignoreCase) {
        // Check for exact-case match
        for (; pivot <= end; pivot++) {
                lb->GetValue(pivot, item, maxItemLen);
                if (!strncmp(word, item, lenWord)) {
                        location = pivot;
                        break;
                }
                if (CompareNCaseInsensitive(word, item, lenWord))
                        break;
        }

which perversely seems to be seeking the first case sensitive match in the list 
only when non-case sensitive searches are requested.

Surely, if you have said "case-insensitive", you should get case-insensitive 
behaviour. The act of preferring an exact match, even when case insensitivity 
is specified is odd, and causes unexpected and unwanted results.

If this is the designed behaviour, then it would be nice to mention in the 
documentation that all items in autocompletion lists have to be cased 
identically to avoid unexpected selections.

A possible fix is to delete this code - or have a specific enable for it.

Best wishes to all,

Greg Smith

_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to