From 7e28018e31529e0ee9e0b9dcfec494a3fa72498d Mon Sep 17 00:00:00 2001 From: White3ger <67337370+White3ger@users.noreply.github.com> Date: Thu, 28 Aug 2025 23:37:56 +0200 Subject: [PATCH] bugfix AutoIdentation growing lines #33 Bugfix according to the GitHub issue #33 (the author found the solution already). --- AGK/AgkIde/TextEditor.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AGK/AgkIde/TextEditor.cpp b/AGK/AgkIde/TextEditor.cpp index 8ab99abc..d3500ccd 100644 --- a/AGK/AgkIde/TextEditor.cpp +++ b/AGK/AgkIde/TextEditor.cpp @@ -6157,11 +6157,12 @@ void TextEditor::EnterCharacter(Char aChar, bool aShift, int codepoint) lastKeyedWord[0] = 0; InsertLine(coord.mLine + 1); auto& line = mLines[coord.mLine]; - auto& newLine = mLines[coord.mLine + 1]; + auto& newLine = mLines[coord.mLine + 1]; if (pref.bAutoIndentation) // mLanguageDefinition.mAutoIndentation { - for (size_t it = 0; it < line.size() && isblank((unsigned char)line[it].mChar); ++it) { + size_t columns = (line.size() < coord.mColumn) ? line.size() : coord.mColumn; + for (size_t it = 0; it < columns && isblank((unsigned char)line[it].mChar); ++it) { newLine.push_back(line[it]); if (iTotalAdd < MAX_PATH - 1) { cTotalAdded[iTotalAdd++] = line[it].mChar;