diff --git a/lib/widgets/chat/chat_input.dart b/lib/widgets/chat/chat_input.dart index 53ae9f32..d951cf00 100644 --- a/lib/widgets/chat/chat_input.dart +++ b/lib/widgets/chat/chat_input.dart @@ -550,11 +550,13 @@ class ChatInput extends HookConsumerWidget { final triggerIndex = atIndex > colonIndex ? atIndex : colonIndex; if (triggerIndex == -1) return []; + final chopped = pattern.substring(triggerIndex); + if (chopped.contains(' ')) return []; final service = ref.read(autocompleteServiceProvider); try { return await service.getSuggestions( chatRoom.id, - pattern, + chopped, ); } catch (e) { return []; @@ -645,7 +647,7 @@ class ChatInput extends HookConsumerWidget { direction: VerticalDirection.up, hideOnEmpty: true, hideOnLoading: true, - debounceDuration: const Duration(milliseconds: 500), + debounceDuration: const Duration(milliseconds: 1000), ), ), IconButton( diff --git a/lib/widgets/post/compose_form_fields.dart b/lib/widgets/post/compose_form_fields.dart index ccf11b94..2ccbaa45 100644 --- a/lib/widgets/post/compose_form_fields.dart +++ b/lib/widgets/post/compose_form_fields.dart @@ -149,9 +149,11 @@ class ComposeFormFields extends HookConsumerWidget { final triggerIndex = atIndex > colonIndex ? atIndex : colonIndex; if (triggerIndex == -1) return []; + final chopped = pattern.substring(triggerIndex); + if (chopped.contains(' ')) return []; final service = ref.read(autocompleteServiceProvider); try { - return await service.getGeneralSuggestions(pattern); + return await service.getGeneralSuggestions(chopped); } catch (e) { return []; } @@ -235,7 +237,7 @@ class ComposeFormFields extends HookConsumerWidget { direction: VerticalDirection.down, hideOnEmpty: true, hideOnLoading: true, - debounceDuration: const Duration(milliseconds: 500), + debounceDuration: const Duration(milliseconds: 1000), ), ], ),