summaryrefslogtreecommitdiff
path: root/src/client/view/search.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-04-13 14:06:29 +0200
committerAlon Levy <alon@pobox.com>2015-04-13 14:06:29 +0200
commit5bfc1efe4516ab27dca1315549655fcc5327a396 (patch)
tree110201d789366154050e3ce330c46b006bc02a62 /src/client/view/search.js
parent348ac301c8c7f1619c2f715208c5a7e09e26c73c (diff)
client search/completer: use '|' only for separation, append on enter from complete
Diffstat (limited to 'src/client/view/search.js')
-rw-r--r--src/client/view/search.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/client/view/search.js b/src/client/view/search.js
index d11d8218..35edd8e7 100644
--- a/src/client/view/search.js
+++ b/src/client/view/search.js
@@ -13,9 +13,10 @@ var focus = function() {
function init() {
search_completer = completer(search, search_completer_element,
{
- triggerStart:' |',
- triggerEnd:' |',
+ triggerStart:'|',
+ triggerEnd:'|',
matchStartOfString: true,
+ appendOnCompletion:'|',
});
search_completer.options.plug(textanalysis.suggestions_options.map('.nodes'));
@@ -49,13 +50,14 @@ function init() {
function search_on_submit(text) {
var r,
selector = function (obj) { return attribute_match(obj, r); };
+ text_processed = text[text.length - 1] == '|' ? text.slice(0, text.length - 1) : text;
try {
- r = new RegExp(text.replace(/ /, '|'), 'i');
+ r = new RegExp(text_processed, 'i');
} catch (e) {
return; // don't clear selection either
}
- if (text.length > 0) {
+ if (text_processed.length > 0) {
selection.byVisitors(selector, selector);
} else {
selection.clear();