From 8522ca42165b0174c358fe6b181a63dedd048fb7 Mon Sep 17 00:00:00 2001 From: unknown <81806010+marsej@users.noreply.github.com> Date: Sat, 11 Dec 2021 07:02:11 +0200 Subject: [PATCH] commenting blank now does nothing --- IDE/src/ui/SourceEditWidgetContent.bf | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/IDE/src/ui/SourceEditWidgetContent.bf b/IDE/src/ui/SourceEditWidgetContent.bf index a3d94bd9..bb06a5c2 100644 --- a/IDE/src/ui/SourceEditWidgetContent.bf +++ b/IDE/src/ui/SourceEditWidgetContent.bf @@ -2280,7 +2280,23 @@ namespace IDE.ui int firstCharPos = minPos + (startLen - afterTrimStart); int lastCharPos = maxPos - (afterTrimStart - afterTrimEnd); - if ((doComment != true) && (trimmedStr.Contains("//"))) + + int q = 0; + var nc = trimmedStr.Count('\n'); + + if(afterTrimEnd == 0) + { + if (undoBatchStart != null) + mData.mUndoManager.Add(undoBatchStart.mBatchEnd); + + CursorLineAndColumn = startLineAndCol; + + if (doComment == null) + mSelection = null; + + return false; // not sure if this should be false in blank/only whitespace selection case + } + else if ((doComment != true) && (trimmedStr.Contains("//"))) { for (int i = firstCharPos; i < lastCharPos - 1; i++) { @@ -2298,9 +2314,7 @@ namespace IDE.ui } mSelection = EditSelection(minPos, lastCharPos); } - int q = 0; - var nc = trimmedStr.Count('\n'); - if ((doComment != true) && (trimmedStr.StartsWith("/*"))) + else if ((doComment != true) && (trimmedStr.StartsWith("/*"))) { if (trimmedStr.EndsWith("*/\n")) {