Don't attach/detach autocomplete on change if already attached/detached

This commit is contained in:
Aaron O'Mullan 2014-01-28 01:24:08 +01:00
commit afd9c99da2

View file

@ -143,10 +143,12 @@ var onChangeAutocomplete = function(e, editor) {
// The prefix to autocomplete for
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
var hasCompleter = (editor.completer && editor.completer.activated);
// Only autocomplete if there's a prefix that can be matched
if(prefix !== '') {
if(prefix !== '' && !(hasCompleter)) {
Autocomplete.startCommand.exec(editor);
} else if(editor.completer && editor.completer.activated) {
} else if(prefix === '' && hasCompleter) {
// When the prefix is empty
// close the autocomplete dialog
editor.completer.detach();