From 60c1c22a73b154970c7437759543b5dbbc561dca Mon Sep 17 00:00:00 2001 From: paxcut <53811119+paxcut@users.noreply.github.com> Date: Wed, 23 Apr 2025 06:54:39 -0700 Subject: [PATCH] fix: fixes Issue #1621 (#2189) fixes Issue #1621. Using shift-tab on an empty line caused a crash. Additionally, changed the hard coded value of 4 to the tab size variable it really needs to be. --- lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp b/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp index 591e9fd94..301ed796c 100644 --- a/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp +++ b/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp @@ -1479,8 +1479,8 @@ void TextEditor::EnterCharacter(ImWchar aChar, bool aShift) { SetCursorPosition(Coordinates(coord.mLine, GetCharacterColumn(coord.mLine, cindex + spacesToInsert))); } else { auto spacesToRemove = (cindex % mTabSize); - if (spacesToRemove == 0) spacesToRemove = 4; - + if (spacesToRemove == 0) spacesToRemove = mTabSize; + spacesToRemove = std::min(spacesToRemove, (int32_t) line.size()); for (int j = 0; j < spacesToRemove; j++) { if ((line.begin() + cindex - 1)->mChar == ' ') { line.erase(line.begin() + cindex - 1);