From 118becf87f46ac0657e450ce8e267283e8a75817 Mon Sep 17 00:00:00 2001
From: Jake Carletto <=jcarletto27@gmail.com>
Date: Tue, 7 Jul 2026 16:26:46 -0400
Subject: [PATCH] added multi-line for macros
---
src/components/Controls/Fields/Input.js | 31 ++++++++++++++++++++++++-
src/components/Panels/Macros.js | 22 ++++++++++++------
src/tabs/interface/importHelper.js | 6 +++++
3 files changed, 51 insertions(+), 8 deletions(-)
diff --git a/src/components/Controls/Fields/Input.js b/src/components/Controls/Fields/Input.js
index d37ec173e..02f96bd69 100644
--- a/src/components/Controls/Fields/Input.js
+++ b/src/components/Controls/Fields/Input.js
@@ -97,7 +97,9 @@ const Input = ({
disabled,
prec,
shortkey,
- ...rest
+ multiline = false,
+ rows = 8,
+ ...rest
}) => {
const { interfaceSettings, connectionSettings } = useSettingsContext()
const dependIds = generateDependIds(
@@ -327,7 +329,34 @@ const Input = ({
//but this is a quick fix
let classAddition = ""
if (rest.class) classAddition = rest.class.replace("form-input", "")
+
+ if (multiline) {
return (
+
+
+ {button}
+
+ )
+ }
+
+return (
{
window.open(action)
}
break
- case "CMD":
- //split by ; and show in terminal
- const commandsList = action.trim().split(";")
- commandsList.forEach((command) => {
- sendCommand(command)
- })
- break
+ case "CMD": {
+ // Newline-delimited macros preserve semicolon G-code comments. Existing
+ // one-line macros keep their legacy semicolon-separated behavior.
+ const macroText = String(action || "").replace(/\r\n?/g, "\n").trim()
+ const commandsList = (macroText.includes("\n")
+ ? macroText.split("\n")
+ : macroText.split(";"))
+ .map((command) => command.trim())
+ .filter((command) => command.length > 0)
+
+ commandsList.forEach((command) => {
+ sendCommand(command)
+ })
+ break
+ }
default:
console.log("type:", type, " action:", action)
break
diff --git a/src/tabs/interface/importHelper.js b/src/tabs/interface/importHelper.js
index 4cf7aad65..4f44dc820 100644
--- a/src/tabs/interface/importHelper.js
+++ b/src/tabs/interface/importHelper.js
@@ -166,6 +166,12 @@ function formatItem(itemData, index = -1, origineId = "extrapanels") {
newItem.type = "text"
newItem.label = "S159"
newItem.min = "1"
+ // The action field is G-code for CMD macros; keep all macro actions editable
+ // as a textarea so switching the macro type does not require a reload.
+ if (origineId == "macros") {
+ newItem.multiline = true
+ newItem.rows = 8
+ }
break
case "value":
newItem.type = "text"