Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit 9125d5a

Browse files
jamesbutkovicnshahan
authored andcommitted
Allow '[' for start of word of highlight match
PiperOrigin-RevId: 187900024
1 parent fb3c3a1 commit 9125d5a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/model/ui/highlighted_text_model.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,17 @@ class TextHighlighter {
7575
if (index == -1) {
7676
break;
7777
} else {
78+
String wrapperToken = index != 0 ? _matchText[index - 1] : null;
7879
if (!matchFromStartOfWord ||
7980
(index == 0 ||
8081
// Some suggestions will have an alternate label appended to
81-
// the end of the suggestion and enclosed in parenthesis. We
82-
// want to highlight matches to words that are wrapped in
83-
// parenthesis so we add this check here.
84-
_matchText[index - 1] == "(" ||
85-
_matchText[index - 1] == " ")) {
82+
// the end of the suggestion and enclosed in parenthesis or
83+
// square brackets. We want to highlight matches to words that
84+
// are wrapped in square brackets and parenthesis so we add
85+
// this check here.
86+
wrapperToken == "(" ||
87+
wrapperToken == " " ||
88+
wrapperToken == "[")) {
8689
markers[index] = max(markers[index], token.length);
8790
}
8891
index += token.length;

0 commit comments

Comments
 (0)