This almost works. The problem is that preventDefault does not do, what I thought it does. When I press Enter, a new-line is also inserted, after the completion is accepted.
I took a look at the source code of the autocompletion module, but I cannot figure out how does it disable the new-line insertion (or movement of the cursor, in the case of the arrows).
So how does the autocomplete module prevent default key effects?
That still begs the question: what should preventDefault do in the case run returns false?
I understand the docs as âit should prevent a new-line to be added in this caseâ. But it does not.
preventDefaultâ ?: boolean
When set to true (the default is false), this will always prevent the further handling for the bound key, even if the command(s) return false. This can be useful for cases where the native behavior of the key is annoying or irrelevant but the command doesnât always apply (such as, Mod-u for undo selection, which would cause the browser to view source instead when no selection can be undone).