Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
typeahead: Increase token limit to scan '#'.
apoorvapendse5787a11b5362
diff --git a/web/src/composebox_typeahead.ts b/web/src/composebox_typeahead.tsindex 64ebc13fc6b..fc77d2c444e 100644--- a/web/src/composebox_typeahead.ts+++ b/web/src/composebox_typeahead.ts@@ -411,7 +411,9 @@ export function tokenize_compose_str(s: string): string {// after the first character.let i = s.length;- let min_i = s.length - 25;+ // We limit how far back to scan to limit potential weird behavior+ // in very long messages, and simplify performance analysis.+ let min_i = s.length - 40;if (min_i < 0) {min_i = 0;}diff --git a/web/tests/composebox_typeahead.test.cjs b/web/tests/composebox_typeahead.test.cjsindex 8a76a297b16..3e21d219dad 100644--- a/web/tests/composebox_typeahead.test.cjs+++ b/web/tests/composebox_typeahead.test.cjs@@ -1922,7 +1922,8 @@ test("tokenizing", () => {assert.equal(ct.tokenize_compose_str("foo ~~~why = why_not\n~~~"), "~~~");// The following cases are kinda judgment calls...- assert.equal(ct.tokenize_compose_str("foo @toomanycharactersisridiculoustocomplete"), "");+ // max scanning limit is 40 characters until chars like @, # , / are found+ assert.equal(ct.tokenize_compose_str("foo @toomanycharactersistooridiculoustocomplete"), "");assert.equal(ct.tokenize_compose_str("foo #bar@foo"), "#bar@foo");});