From 755be518be4a13f6b8930da70db2ac6f56b9b0d2 Mon Sep 17 00:00:00 2001 From: Petr Mironychev <9195189+Palm1r@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:52:13 +0200 Subject: [PATCH] fix: Empty context for empty file --- tools/EditProjectFileTool.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/EditProjectFileTool.cpp b/tools/EditProjectFileTool.cpp index 8938a23..774f85b 100644 --- a/tools/EditProjectFileTool.cpp +++ b/tools/EditProjectFileTool.cpp @@ -364,6 +364,12 @@ void EditProjectFileTool::extractContext( if (lineNumber > 0 && lineNumber <= lines.size()) { targetLine = lineNumber - 1; } + } else if (mode == EditMode::AppendToEnd) { + if (!lines.isEmpty()) { + int startLine = qMax(0, lines.size() - contextLines); + contextBefore = lines.mid(startLine).join('\n'); + } + return; } if (targetLine == -1) {