Further improvement error reporting with buggy custom G-code sections #1516

1) The macro-processor sanitizes the source code line for invalid UTF-8
   characters. Ideally these invalid characters would be replaced with ?,
   they are just dropped as of now. Better than showing an empty string
   when converting to wxString though.
2) G-code export collects full error message for 1st occurence of an error
   for each custom G-code block.
3) The composite error message now displays the errors collected in 2).
4) The error window is now scaled bigger and the Slicer logo is smaller
   if the text is to be rendered with monospaced font, as the monospaced
   text will not be word wrapped.
This commit is contained in:
Vojtech Bubnik 2020-12-03 12:50:18 +01:00
parent b251fea5fe
commit 3dd9b8c718
7 changed files with 31 additions and 15 deletions

View file

@ -6,6 +6,7 @@
#include <iomanip>
#include <sstream>
#include <map>
#include <boost/nowide/convert.hpp>
#ifdef _MSC_VER
#include <stdlib.h> // provides **_environ
#else
@ -870,7 +871,9 @@ namespace client
}
}
msg += '\n';
msg += error_line;
// This hack removes all non-UTF8 characters from the source line, so that the upstream wxWidgets conversions
// from UTF8 to UTF16 don't bail out.
msg += boost::nowide::narrow(boost::nowide::widen(error_line));
msg += '\n';
for (size_t i = 0; i < error_pos; ++ i)
msg += ' ';