From c313e6793a4d837960949fdd26a2511c0066c749 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Mon, 18 Oct 2021 15:46:13 +0200 Subject: [PATCH] Follow-up to 1ca24f0bd03d7f97d576bfac43022733459a9c92 Fixed visualization of G-code in G-code viewer after 07e7e115901c80f282b06ea6b86bc56b28e1a02b The line end positions were not extracted correctly from G-code imported into a stand-alone G-code viewer. --- src/libslic3r/GCodeReader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCodeReader.cpp b/src/libslic3r/GCodeReader.cpp index 7b106463a..aa04e69f2 100644 --- a/src/libslic3r/GCodeReader.cpp +++ b/src/libslic3r/GCodeReader.cpp @@ -152,7 +152,7 @@ bool GCodeReader::parse_file_raw_internal(const std::string &filename, ParseLine auto it_end = it; for (; it_end != it_bufend && ! (eol = *it_end == '\r' || *it_end == '\n'); ++ it_end) if (*it_end == '\n') - line_end_callback((it_end - buffer.begin()) + 1); + line_end_callback(file_pos + (it_end - buffer.begin()) + 1); // End of line is indicated also if end of file was reached. eol |= eof && it_end == it_bufend; if (eol) { @@ -173,7 +173,7 @@ bool GCodeReader::parse_file_raw_internal(const std::string &filename, ParseLine if (it != it_bufend && *it == '\r') ++ it; if (it != it_bufend && *it == '\n') { - line_end_callback((it - buffer.begin()) + 1); + line_end_callback(file_pos + (it - buffer.begin()) + 1); ++ it; } }