Fix #4169: Tag operators not working with autocomplete.
This commit is contained in:
@@ -101,9 +101,6 @@ Autocomplete.initialize_tag_autocomplete = function() {
|
|||||||
if (!metatag && !term) {
|
if (!metatag && !term) {
|
||||||
this.close();
|
this.close();
|
||||||
return;
|
return;
|
||||||
} else if (!metatag && term) {
|
|
||||||
Autocomplete.normal_source(term, resp);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (metatag) {
|
switch (metatag) {
|
||||||
@@ -142,6 +139,9 @@ Autocomplete.initialize_tag_autocomplete = function() {
|
|||||||
case "search":
|
case "search":
|
||||||
Autocomplete.saved_search_source(term, resp);
|
Autocomplete.saved_search_source(term, resp);
|
||||||
break;
|
break;
|
||||||
|
case "tag":
|
||||||
|
Autocomplete.normal_source(term, resp);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
resp([]);
|
resp([]);
|
||||||
break;
|
break;
|
||||||
@@ -271,6 +271,7 @@ Autocomplete.normal_source = function(term, resp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Autocomplete.parse_query = function(text, caret) {
|
Autocomplete.parse_query = function(text, caret) {
|
||||||
|
var operator = "";
|
||||||
var metatag = "";
|
var metatag = "";
|
||||||
var term = "";
|
var term = "";
|
||||||
|
|
||||||
@@ -282,9 +283,14 @@ Autocomplete.parse_query = function(text, caret) {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
match = term.match(/^([-~])(.*)$/);
|
||||||
|
if (match) {
|
||||||
|
operator = match[1];
|
||||||
|
term = match[2];
|
||||||
|
}
|
||||||
|
|
||||||
match = term.match(Autocomplete.TAG_PREFIXES_REGEX);
|
match = term.match(Autocomplete.TAG_PREFIXES_REGEX);
|
||||||
if (match) {
|
if (match) {
|
||||||
metatag = match[1].toLowerCase();
|
|
||||||
term = match[2];
|
term = match[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,9 +298,11 @@ Autocomplete.parse_query = function(text, caret) {
|
|||||||
if (match) {
|
if (match) {
|
||||||
metatag = match[1].toLowerCase();
|
metatag = match[1].toLowerCase();
|
||||||
term = match[2];
|
term = match[2];
|
||||||
|
} else {
|
||||||
|
metatag = "tag";
|
||||||
}
|
}
|
||||||
|
|
||||||
return { metatag: metatag, term: term };
|
return { operator: operator, metatag: metatag, term: term };
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update the input field with the item currently focused in the
|
// Update the input field with the item currently focused in the
|
||||||
|
|||||||
Reference in New Issue
Block a user