From 7867af858db30f8b6c2dc038d46f936ce9e1f043 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Tue, 21 Sep 2021 09:08:18 +0200 Subject: [PATCH] fix: Only use prefix switching if we have complex bundles --- lib/pages/chat.dart | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/pages/chat.dart b/lib/pages/chat.dart index bc983703..562cecba 100644 --- a/lib/pages/chat.dart +++ b/lib/pages/chat.dart @@ -739,17 +739,19 @@ class ChatController extends State { } void onInputBarChanged(String text) { - final clients = currentRoomBundle; - for (final client in clients) { - final prefix = client.sendPrefix; - if ((prefix?.isNotEmpty ?? false) && - text.toLowerCase() == '${prefix.toLowerCase()} ') { - setSendingClient(client); - setState(() { - inputText = ''; - sendController.text = ''; - }); - return; + if (text.endsWith(' ') && matrix.hasComplexBundles) { + final clients = currentRoomBundle; + for (final client in clients) { + final prefix = client.sendPrefix; + if ((prefix?.isNotEmpty ?? false) && + text.toLowerCase() == '${prefix.toLowerCase()} ') { + setSendingClient(client); + setState(() { + inputText = ''; + sendController.text = ''; + }); + return; + } } } typingCoolDown?.cancel();