From 21ae88702f26c009e65a1c6558939a7e30e48cdb Mon Sep 17 00:00:00 2001 From: paxcut <53811119+paxcut@users.noreply.github.com> Date: Sun, 1 Dec 2024 01:58:37 -0700 Subject: [PATCH] fix: Empty text editor has no cursor. (#1976) Even if focus is given to the pattern editor the cursor will not show until the editor contains printable chars. ### Problem description I was using the wrong condition to enter the loop that skipped the default empty document. ### Implementation description The fix was to check if there are lines of text that need to be processed even if they are empty. --- lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp b/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp index 400ff8f6a..3f2eac276 100644 --- a/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp +++ b/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp @@ -877,7 +877,7 @@ void TextEditor::Render() { buf[0] = '\0'; mTextStart = ImGui::GetFont()->CalcTextSizeA(ImGui::GetFontSize(), FLT_MAX, -1.0f, buf, nullptr, nullptr).x + mLeftMargin; - if (!isEmpty()) { + if (lineNo <= lineMax) { float spaceSize = ImGui::GetFont()->CalcTextSizeA(ImGui::GetFontSize(), FLT_MAX, -1.0f, " ", nullptr, nullptr).x; while (lineNo <= lineMax) {