diff --git a/lib/ace/autocomplete.js b/lib/ace/autocomplete.js index 16707595..520185d8 100644 --- a/lib/ace/autocomplete.js +++ b/lib/ace/autocomplete.js @@ -138,14 +138,16 @@ var Autocomplete = function() { data.completer.insertMatch(this.editor); } else { if (this.completions.filterText) { - var range = this.editor.selection.getRange(); - range.start.column -= this.completions.filterText.length; - this.editor.session.remove(range); + var ranges = this.editor.selection.getAllRanges(); + for (var i = 0, range; range = ranges[i]; i++) { + range.start.column -= this.completions.filterText.length; + this.editor.session.remove(range); + } } if (data.snippet) snippetManager.insertSnippet(this.editor, data.snippet); else - this.editor.insert(data.value || data); + this.editor.execCommand("insertstring", data.value || data); } };