Fixed comment handling in GCODE lines, escapes are no longer stripped

A good example while late night commits can sometimes be a bad idea.
This commit is contained in:
Gina Häußge 2015-03-06 11:37:06 +01:00
parent fbca845bbd
commit e79fd99a41
2 changed files with 4 additions and 4 deletions

View file

@ -1846,7 +1846,7 @@ def strip_comment(line):
for c in line:
if c == ";" and not escaped:
break
result += c if c != "\\" or escaped else ""
result += c
escaped = (c == "\\") and not escaped
return "".join(result)

View file

@ -15,9 +15,9 @@ class TestCommHelpers(unittest.TestCase):
@data(
("M117 Test", "M117 Test"),
("M117 Test ; foo", "M117 Test "),
("M117 Test \\; foo", "M117 Test ; foo"),
("M117 Test \\\\; foo", "M117 Test \\"),
("M117 Test \\\\\\; foo", "M117 Test \\; foo"),
("M117 Test \\; foo", "M117 Test \\; foo"),
("M117 Test \\\\; foo", "M117 Test \\\\"),
("M117 Test \\\\\\; foo", "M117 Test \\\\\\; foo"),
("; foo", "")
)
@unpack