[Autocomplete] fix insertion of words containing - sign

This commit is contained in:
nightwing 2013-06-16 21:06:40 +04:00
commit f82c4df96a
2 changed files with 19 additions and 16 deletions

View file

@ -138,8 +138,11 @@ var Autocomplete = function() {
} else {
if (data.value)
data = data.value;
if (this.completions.filterText)
this.editor.removeWordLeft();
if (this.completions.filterText) {
var range = this.editor.selection.getRange();
range.start.column -= this.completions.filterText.length;
this.editor.session.remove(range);
}
this.editor.insert(data);
}
};

View file

@ -32,20 +32,20 @@ define(function(require, exports, module) {
"use strict";
exports.parForEach = function(array, fn, callback) {
var completed = 0;
var arLength = array.length;
if (arLength === 0)
callback();
for (var i = 0; i < arLength; i++) {
fn(array[i], function(result, err) {
completed++;
if (completed === arLength)
callback(result, err);
});
}
var completed = 0;
var arLength = array.length;
if (arLength === 0)
callback();
for (var i = 0; i < arLength; i++) {
fn(array[i], function(result, err) {
completed++;
if (completed === arLength)
callback(result, err);
});
}
}
var ID_REGEX = /[a-zA-Z_0-9\$]/;
var ID_REGEX = /[a-zA-Z_0-9\$-]/;
exports.retrievePrecedingIdentifier = function(text, pos, regex) {
regex = regex || ID_REGEX;