How can we explain the behavior of auto-complete using logic? In very broad terms it could look something like the simple flowchart below for a keystroke event. I assumed the default 3 character minimum for auto-completion, assumed auto-completion is selected, and assumed that a regular key is entered, not a hotkey. And of course the dialog box open, list populate, and dialog box close would be subprograms while the dialog box selection would be a new event with its own handler.
When we look at your question - why doesn't the dialog box close when there is only one choice and you don't select it - it makes sense why that doesn't happen. It is easy to code for something happening (an event). It is difficult or impossible to code for something not happening. Logic waits until a different event happens (which means you are really coding for the new event, not the non-event). It is easy to detect typing. It is impossible to detect not typing. At best you can detect not typing for a given period of time, but that doesn't 100% prove that typing has ended, only that time has expired. Maybe the user stopped to check a dictionary, to pick up the pen he/she dropped, or to go to the restroom. Maybe the user really is done, but logic cannot be written for maybe.
And in answer to your second question: "German" typed, why isn't "german" listed as a choice?
The table of choices auto-complete uses comes from four sources:
- the syntax-highlighting file linked to the active file or the default syntax file if the active file is new and not yet named
- the function list of the active file
- a user selected file of words specified by Advanced->Configuration->Editor->Word Wrap/Tab Settings-> Auto-complete file (default is no file)
- the previous 50K of the active file
So "german" has to be found in one of those locations in order to show up as a choice for auto-complete.

- autosellogic.png (23.68 KiB) Viewed 695 times