1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

Merge pull request #2193 from Fusioon/fix-#2148

Preserve cursor position on CommentLines
This commit is contained in:
Brian Fiete 2025-03-21 08:40:50 -04:00 committed by GitHub
commit 466ada3d0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3019,6 +3019,7 @@ namespace IDE.ui
didLineComment = false;
lineStartCol = 0;
int appendedCount = 0;
for (int i = minPos; i < maxPos; i++)
{
var c = mData.mText[i].mChar;
@ -3056,6 +3057,8 @@ namespace IDE.ui
InsertAtCursor(str);
didLineComment = true;
maxPos += str.Length;
if (i <= startTextPos + appendedCount)
appendedCount += str.Length;
}
}
mSelection = EditSelection(minPos, maxPos);
@ -3063,6 +3066,9 @@ namespace IDE.ui
if (undoBatchStart != null)
mData.mUndoManager.Add(undoBatchStart.mBatchEnd);
if (appendedCount > 0)
CursorTextPos = startTextPos + appendedCount;
else
CursorLineAndColumn = startLineAndCol;
if (!hadSelection)