Skip to content

Commit 0edb42a

Browse files
committed
fix: AutocompleteTrigger not correctly working with multiline text.
Signed-off-by: xsahil03x <[email protected]>
1 parent 08f128c commit 0edb42a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Diff for: CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
## Upcoming
22

33
* Fixed `FieldView` focus getting lost on clicking the `OptionsView` on non-mobile platforms.
4-
* Fixed `RangeError` when `textEditingValue.selection.isInvalid`. [#11](https://github.com/xsahil03x/multi_trigger_autocomplete/issues/11)
4+
* Fixed `RangeError` when `textEditingValue.selection.isInvalid`.
5+
[#11](https://github.com/xsahil03x/multi_trigger_autocomplete/issues/11)
6+
* Fixed `AutocompleteTrigger` not getting triggered when the text is a multi-line
7+
string. [#12](https://github.com/xsahil03x/multi_trigger_autocomplete/issues/12)
58

69
## 0.1.1
710

Diff for: lib/src/autocomplete_trigger.dart

+4-3
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ class AutocompleteTrigger {
8181
return null;
8282
}
8383

84-
// Only show typing suggestions after a space, or at the start of the input
85-
// valid examples: "@user", "Hello @user"
84+
// Only show typing suggestions after a space, new line or at the start of the input.
85+
// valid examples: "@user", "Hello @user", "Hello\n@user"
8686
// invalid examples: "Hello@user"
8787
final textBeforeTrigger = text.substring(0, firstTriggerIndexBeforeCursor);
8888
if (triggerOnlyAfterSpace &&
8989
textBeforeTrigger.isNotEmpty &&
90-
!textBeforeTrigger.endsWith(' ')) {
90+
!(textBeforeTrigger.endsWith(' ') ||
91+
textBeforeTrigger.endsWith('\n'))) {
9192
return null;
9293
}
9394

0 commit comments

Comments
 (0)