From 9051b6e206dfee345ed55caea922d0be814c1ad2 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 9 May 2019 18:56:13 +0200 Subject: [PATCH] Update imgui color text edit to a179931d. --- imguicolortextedit/TextEditor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/imguicolortextedit/TextEditor.cpp b/imguicolortextedit/TextEditor.cpp index e3b878f1..caef161d 100644 --- a/imguicolortextedit/TextEditor.cpp +++ b/imguicolortextedit/TextEditor.cpp @@ -938,6 +938,9 @@ void TextEditor::EnterCharacter(Char aChar, bool aShift) end.mColumn = (int)mLines[end.mLine].size(); } + if (end.mColumn >= (int)mLines[end.mLine].size()) + end.mColumn = (int)mLines[end.mLine].size() - 1; + u.mRemovedStart = start; u.mRemovedEnd = end; u.mRemoved = GetText(start, end); @@ -981,6 +984,8 @@ void TextEditor::EnterCharacter(Char aChar, bool aShift) if (modified) { + assert(mLines.size() > start.mLine && mLines[start.mLine].size() > start.mColumn); + assert(mLines.size() > end.mLine && mLines[end.mLine].size() > end.mColumn); u.mAddedStart = start; u.mAddedEnd = end; u.mAdded = GetText(start, end); @@ -1952,7 +1957,6 @@ void TextEditor::ColorizeInternal() } } mCheckComments = false; - return; } if (mColorRangeMin < mColorRangeMax)