1
0
mirror of synced 2025-01-25 15:53:43 +01:00

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.
This commit is contained in:
paxcut 2024-12-01 01:58:37 -07:00 committed by GitHub
parent 0ff1bb392c
commit 21ae88702f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {