do not close the popup if there are matching completions

This commit is contained in:
nightwing 2014-07-03 00:12:27 +04:00
commit 8ed2799620
2 changed files with 6 additions and 11 deletions

View file

@ -101,12 +101,12 @@ var Autocomplete = function() {
this.changeTimer.cancel(); this.changeTimer.cancel();
if (this.popup && this.popup.isOpen) { if (this.popup && this.popup.isOpen) {
this.gatherCompletionsId = this.gatherCompletionsId + 1; this.gatherCompletionsId += 1;
this.popup.hide();
} }
if (this.popup) if (this.base)
this.popup.hide(); this.base.detach();
this.activated = false; this.activated = false;
this.completions = this.base = null; this.completions = this.base = null;
}; };
@ -205,8 +205,7 @@ var Autocomplete = function() {
var line = session.getLine(pos.row); var line = session.getLine(pos.row);
var prefix = util.retrievePrecedingIdentifier(line, pos.column); var prefix = util.retrievePrecedingIdentifier(line, pos.column);
this.base = editor.getCursorPosition(); this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
this.base.column -= prefix.length;
var matches = []; var matches = [];
var total = editor.completers.length; var total = editor.completers.length;

View file

@ -161,10 +161,6 @@ var doLiveAutocomplete = function(e) {
editor.completer.autoSelect = false; editor.completer.autoSelect = false;
editor.completer.autoInsert = false; editor.completer.autoInsert = false;
editor.completer.showPopup(editor); editor.completer.showPopup(editor);
} else if (!prefix && hasCompleter) {
// When the prefix is empty
// close the autocomplete dialog
editor.completer.detach();
} }
} }
}; };