mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-14 12:35:59 +08:00
gcode: keep line endins in post processing (#8092)
Some portions of GCode (like BTT_TFT thumbnails) has to be CRLF in order to work correctly. However, gcode post processor was ignoring input line endings style emitting '\n' (LF) into post-processed output.
This commit is contained in:
parent
2ea2ab08de
commit
330ac879c1
@ -5018,9 +5018,18 @@ void GCodeProcessor::run_post_process()
|
|||||||
// End of line is indicated also if end of file was reached.
|
// End of line is indicated also if end of file was reached.
|
||||||
eol |= eof && it_end == it_bufend;
|
eol |= eof && it_end == it_bufend;
|
||||||
gcode_line.insert(gcode_line.end(), it, it_end);
|
gcode_line.insert(gcode_line.end(), it, it_end);
|
||||||
|
|
||||||
|
it = it_end;
|
||||||
|
// append EOL.
|
||||||
|
if (it != it_bufend && *it == '\r') {
|
||||||
|
gcode_line += *it++;
|
||||||
|
}
|
||||||
|
if (it != it_bufend && *it == '\n') {
|
||||||
|
gcode_line += *it++;
|
||||||
|
}
|
||||||
|
|
||||||
if (eol) {
|
if (eol) {
|
||||||
++line_id;
|
++line_id;
|
||||||
gcode_line += "\n";
|
|
||||||
const unsigned int internal_g1_lines_counter = export_lines.update(gcode_line, line_id, g1_lines_counter);
|
const unsigned int internal_g1_lines_counter = export_lines.update(gcode_line, line_id, g1_lines_counter);
|
||||||
// replace placeholder lines
|
// replace placeholder lines
|
||||||
bool processed = process_placeholders(gcode_line);
|
bool processed = process_placeholders(gcode_line);
|
||||||
@ -5057,12 +5066,6 @@ void GCodeProcessor::run_post_process()
|
|||||||
export_lines.write(out, 1.1f * max_backtrace_time, m_result, out_path);
|
export_lines.write(out, 1.1f * max_backtrace_time, m_result, out_path);
|
||||||
gcode_line.clear();
|
gcode_line.clear();
|
||||||
}
|
}
|
||||||
// Skip EOL.
|
|
||||||
it = it_end;
|
|
||||||
if (it != it_bufend && *it == '\r')
|
|
||||||
++it;
|
|
||||||
if (it != it_bufend && *it == '\n')
|
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
if (eof)
|
if (eof)
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user