Commit 5d4993d6 authored by Douwe Maan's avatar Douwe Maan

Only autocomplete commands at the beginning of a line

parent f393f2dd
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
return _.template(tpl)(value); return _.template(tpl)(value);
}, },
insertTpl: function(value) { insertTpl: function(value) {
var tpl = "\n/${name} "; var tpl = "/${name} ";
var reference_prefix = null; var reference_prefix = null;
if (value.params.length > 0) { if (value.params.length > 0) {
reference_prefix = value.params[0][0]; reference_prefix = value.params[0][0];
...@@ -282,7 +282,16 @@ ...@@ -282,7 +282,16 @@
callbacks: { callbacks: {
sorter: this.DefaultOptions.sorter, sorter: this.DefaultOptions.sorter,
filter: this.DefaultOptions.filter, filter: this.DefaultOptions.filter,
beforeInsert: this.DefaultOptions.beforeInsert beforeInsert: this.DefaultOptions.beforeInsert,
matcher: function(flag, subtext, should_startWithSpace, acceptSpaceBar) {
var regexp = /(?:^|\n)\/([A-Za-z_]*)$/gi
var match = regexp.exec(subtext);
if (match) {
return match[1];
} else {
return null;
}
}
} }
}); });
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment