1
0
mirror of synced 2024-11-24 15:50:16 +01:00

fix: Pattern editor error tooltip becoming way too large in some cases

This commit is contained in:
WerWolv 2023-12-27 17:29:27 +01:00
parent 99dcd0a020
commit 686f8f43c3

View File

@ -749,8 +749,22 @@ namespace hex::plugin::builtin {
if (!m_lastEvaluationProcessed) {
if (!m_lastEvaluationResult) {
if (m_lastEvaluationError->has_value()) {
const auto message = [this]{
auto message = (*m_lastEvaluationError)->message;
auto lines = wolv::util::splitString(message, "\n");
std::ranges::transform(lines, lines.begin(), [](auto line) {
if (line.size() >= 128)
line = wolv::util::trim(line);
return hex::limitStringLength(line, 128);
});
return wolv::util::combineStrings(lines, "\n");
}();
TextEditor::ErrorMarkers errorMarkers = {
{ (*m_lastEvaluationError)->line, (*m_lastEvaluationError)->message }
{ (*m_lastEvaluationError)->line, message }
};
m_textEditor.SetErrorMarkers(errorMarkers);
}