Don't attach/detach autocomplete on change if already attached/detached
This commit is contained in:
parent
07c99e0541
commit
afd9c99da2
1 changed files with 4 additions and 2 deletions
|
|
@ -143,10 +143,12 @@ var onChangeAutocomplete = function(e, editor) {
|
||||||
// The prefix to autocomplete for
|
// The prefix to autocomplete for
|
||||||
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
|
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
|
// Only autocomplete if there's a prefix that can be matched
|
||||||
if(prefix !== '') {
|
if(prefix !== '' && !(hasCompleter)) {
|
||||||
Autocomplete.startCommand.exec(editor);
|
Autocomplete.startCommand.exec(editor);
|
||||||
} else if(editor.completer && editor.completer.activated) {
|
} else if(prefix === '' && hasCompleter) {
|
||||||
// When the prefix is empty
|
// When the prefix is empty
|
||||||
// close the autocomplete dialog
|
// close the autocomplete dialog
|
||||||
editor.completer.detach();
|
editor.completer.detach();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue