Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

typeahead: Add match_prefix option to query string matcher.

Pratik Chandad59d08d702a9
diff --git a/web/src/typeahead.ts b/web/src/typeahead.ts
index d3b9f5a2bf9..971ccfa8fd7 100644
--- a/web/src/typeahead.ts
+++ b/web/src/typeahead.ts
@@ -113,8 +113,9 @@ export function query_matches_string_in_order_assume_canonicalized(
query: string,
source_str: string,
split_char: string,
+ match_prefix?: boolean,
): boolean {
- if (!query.includes(split_char)) {
+ if (!query.includes(split_char) && !match_prefix) {
// If query is a single token (doesn't contain a separator),
// the match can be anywhere in the string.
return source_str.includes(query);