GCODE viewer: Support \r, \n and \r\n line endings

So far we only supported \n and \r\n, leading to problems with MM
GCODE files generated by Slic3r Prusa Edition which apparently
produces \r line endings for some reason.

Closes #1996
This commit is contained in:
Gina Häußge 2017-07-20 09:18:38 +02:00
parent 266cae3509
commit 7e32e5be8f

View file

@ -146,7 +146,7 @@ GCODE.gCodeReader = (function(){
this.clear();
var totalSize = reader.target.result.length;
lines = reader.target.result.split(/\n/);
lines = reader.target.result.split(/[\r\n]+/g);
reader.target.result = null;
prepareGCode(totalSize);