From 54dc1550f8e874b002ce12210b4147ca514b61f4 Mon Sep 17 00:00:00 2001 From: Suffocate <70031311+lolsuffocate@users.noreply.github.com> Date: Mon, 15 Sep 2025 12:33:43 +0100 Subject: [PATCH] BetterCommands: Add option to allow newlines (#393) --- src/equicordplugins/betterCommands/index.ts | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/equicordplugins/betterCommands/index.ts b/src/equicordplugins/betterCommands/index.ts index 26dc8dd05..84f1e6d98 100644 --- a/src/equicordplugins/betterCommands/index.ts +++ b/src/equicordplugins/betterCommands/index.ts @@ -15,6 +15,11 @@ const settings = definePluginSettings({ description: "Automatically fill command with all arguements instead of just required ones", type: OptionType.BOOLEAN, default: true, + }, + allowNewlinesInCommands: { + description: "Allow newlines in command inputs (Shift + Enter)", + type: OptionType.BOOLEAN, + default: true, } }); @@ -40,6 +45,26 @@ export default definePlugin({ replace: "true" }, ] + }, + { + find: '"italics"),!0;', + predicate: () => settings.store.allowNewlinesInCommands, + replacement: [ + { + match: /case (\i\.\i)\.TAB:if\(null!=(\i).selection&&\i\((\i)(?=.{0,300}(\i\.\i\.insertText))/, + replace: (orig, keys, editor, event, insertText) => { + return `case ${keys}.ENTER: + if(${event}.shiftKey){ + ${event}.preventDefault(); + ${event}.stopPropagation(); + ${insertText}(${editor},'\\n'); + return true; + } + break; + ${orig}`; + } + } + ] } ], commands: [