From 14585cce7f02248606a9e59a7fbbfc33dc12ab43 Mon Sep 17 00:00:00 2001 From: Branden Cash <203336+ammmze@users.noreply.github.com> Date: Mon, 9 Dec 2024 22:08:27 -0700 Subject: [PATCH] feat(macro-prompts): preserve outer quotes Previously if you had a macro prompt such as the following, the modal title would display `Question`, not `"Question"`. However, in other projects (Klipperscreen and Fluidd), they will preserve those outer quotes and they will be included in the title. This change makes Mainsail consistent with the other implementations. ``` RESPOND TYPE=command MSG="action:prompt_begin \"Question\"" RESPOND TYPE=command MSG="action:prompt_button Button1|RESPOND MSG=\"Clicked it!\"" RESPOND TYPE=command MSG="action:prompt_show" ``` --- src/components/dialogs/TheMacroPrompt.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/dialogs/TheMacroPrompt.vue b/src/components/dialogs/TheMacroPrompt.vue index d89a94328..a6eefa6f6 100644 --- a/src/components/dialogs/TheMacroPrompt.vue +++ b/src/components/dialogs/TheMacroPrompt.vue @@ -61,8 +61,7 @@ export default class TheMacroPrompt extends Mixins(BaseMixin) { private checkpointEvent: ServerStateEvent | null = null private currentPrompt: ServerStateEventPrompt[] = [] // regex that extracts the type and message, omitting the wrapping double quotes of the message (if any) - private promptMessageExp = - /^\/\/ action:prompt_(?[^\s]+) *(?:(?['"])(?.*)\k|(?.*))\s*$/ + private promptMessageExp = /^\/\/ action:prompt_(?[^\s]+) *(?.*)$/ get events() { return this.$store.state.server.events @@ -95,7 +94,7 @@ export default class TheMacroPrompt extends Mixins(BaseMixin) { break } - const message = (match?.groups?.msg1 || match?.groups?.msg2 || '').trim() + const message = (match?.groups?.msg || '').trim() // prepend the event to prompt events found in this chunk promptEvents.unshift({