From 2e5a51bb0553fdac850fabd8e696288458219019 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 30 Jul 2023 00:44:09 +0200 Subject: [PATCH] patterns: Updated pattern language --- lib/external/imgui/source/TextEditor.cpp | 4 ---- lib/external/libwolv | 2 +- lib/external/pattern_language | 2 +- .../source/content/views/view_pattern_editor.cpp | 16 ++++++++++++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/external/imgui/source/TextEditor.cpp b/lib/external/imgui/source/TextEditor.cpp index d0c8da96f..32820add5 100644 --- a/lib/external/imgui/source/TextEditor.cpp +++ b/lib/external/imgui/source/TextEditor.cpp @@ -202,8 +202,6 @@ void TextEditor::DeleteRange(const Coordinates &aStart, const Coordinates &aEnd) } int TextEditor::InsertTextAt(Coordinates & /* inout */ aWhere, const char *aValue) { - assert(!mReadOnly); - int cindex = GetCharacterIndex(aWhere); int totalLines = 0; while (*aValue != '\0') { @@ -541,8 +539,6 @@ void TextEditor::RemoveLine(int aIndex) { } TextEditor::Line &TextEditor::InsertLine(int aIndex) { - assert(!mReadOnly); - auto &result = *mLines.insert(mLines.begin() + aIndex, Line()); ErrorMarkers etmp; diff --git a/lib/external/libwolv b/lib/external/libwolv index d5660b1d3..dfe0da877 160000 --- a/lib/external/libwolv +++ b/lib/external/libwolv @@ -1 +1 @@ -Subproject commit d5660b1d3038c02cc50f70e385c015fa47d1bc4c +Subproject commit dfe0da877f89a0bc88feca5bd44b282344de9677 diff --git a/lib/external/pattern_language b/lib/external/pattern_language index f04456129..244da1845 160000 --- a/lib/external/pattern_language +++ b/lib/external/pattern_language @@ -1 +1 @@ -Subproject commit f0445612925a957cb6da075d37128b718ce3ea0f +Subproject commit 244da18450cdcab432cd1cf13e83472ccd0a9fba diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index 6b10d2d18..267832899 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -306,8 +306,20 @@ namespace hex::plugin::builtin { if (this->m_consoleNeedsUpdate) { std::scoped_lock lock(this->m_logMutex); - this->m_consoleEditor.SetTextLines(*this->m_console); - this->m_consoleEditor.SetCursorPosition({ int(this->m_consoleEditor.GetTextLines().size()), 0 }); + auto lineCount = this->m_consoleEditor.GetTextLines().size() - 1; + if (this->m_console->size() < lineCount) { + this->m_consoleEditor.SetText(""); + lineCount = 0; + } + + this->m_consoleEditor.SetCursorPosition({ int(lineCount + 1), 0 }); + + auto linesToAdd = this->m_console->size() - lineCount; + for (size_t i = 0; i < linesToAdd; i += 1) { + this->m_consoleEditor.InsertText(this->m_console->at(lineCount + i)); + this->m_consoleEditor.InsertText("\n"); + } + this->m_consoleNeedsUpdate = false; }