From 3776e323641c7231cd024a845a5bf1175c346a0f Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 7 Nov 2021 00:32:50 -0400 Subject: [PATCH] Fix commands activating anywhere in the input (#156) * Fix commands activating anywhere in the input Writing `The command to leave a channel is /leave` might have had "fun" consequences for users. Fixes #155 * Fix go-to commands activating anywhere in the input While less obtrusive than `/` commands activating anywhere, it seems logical to only activate completion of those when at the beginning of the input. --- src/app/organisms/room/RoomViewInput.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/organisms/room/RoomViewInput.jsx b/src/app/organisms/room/RoomViewInput.jsx index 6d4a22f..e23b5c1 100644 --- a/src/app/organisms/room/RoomViewInput.jsx +++ b/src/app/organisms/room/RoomViewInput.jsx @@ -29,7 +29,7 @@ import MarkdownIC from '../../../../public/res/ic/outlined/markdown.svg'; import FileIC from '../../../../public/res/ic/outlined/file.svg'; import CrossIC from '../../../../public/res/ic/outlined/cross.svg'; -const CMD_REGEX = /(\/|>[#*@]|:|@)(\S*)$/; +const CMD_REGEX = /(^\/|^>[#*@]|:|@)(\S*)$/; let isTyping = false; let isCmdActivated = false; let cmdCursorPos = null;