From 6c44e210df69d521fafbc06c615c2d359e0c0b58 Mon Sep 17 00:00:00 2001 From: Dylan Knutson Date: Thu, 26 Sep 2024 18:12:05 -0700 Subject: [PATCH] Skip leading whitespace when processing dollar commands --- FluidNC/src/ProcessSettings.cpp | 4 ++++ fixture_tests/fixtures/dollar_command_leading_whitespace.nc | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 fixture_tests/fixtures/dollar_command_leading_whitespace.nc diff --git a/FluidNC/src/ProcessSettings.cpp b/FluidNC/src/ProcessSettings.cpp index 3a4b42aec..9bf29e37f 100644 --- a/FluidNC/src/ProcessSettings.cpp +++ b/FluidNC/src/ProcessSettings.cpp @@ -1031,6 +1031,10 @@ Error execute_line(char* line, Channel& channel, AuthenticationLevel auth_level) if (line[0] == 0) { return Error::Ok; } + // Skip leading whitespace + while (isspace(*line)) { + ++line; + } // User '$' or WebUI '[ESPxxx]' command if (line[0] == '$' || line[0] == '[') { if (gc_state.skip_blocks) { diff --git a/fixture_tests/fixtures/dollar_command_leading_whitespace.nc b/fixture_tests/fixtures/dollar_command_leading_whitespace.nc new file mode 100644 index 000000000..1a73c54e5 --- /dev/null +++ b/fixture_tests/fixtures/dollar_command_leading_whitespace.nc @@ -0,0 +1,4 @@ +-> $X +<- ok +-> $X +<- ok