mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Preserve cursor position on CommentLines
This commit is contained in:
parent
27620fa35d
commit
706d6d1544
1 changed files with 7 additions and 1 deletions
|
@ -3019,6 +3019,7 @@ namespace IDE.ui
|
||||||
|
|
||||||
didLineComment = false;
|
didLineComment = false;
|
||||||
lineStartCol = 0;
|
lineStartCol = 0;
|
||||||
|
int appendedCount = 0;
|
||||||
for (int i = minPos; i < maxPos; i++)
|
for (int i = minPos; i < maxPos; i++)
|
||||||
{
|
{
|
||||||
var c = mData.mText[i].mChar;
|
var c = mData.mText[i].mChar;
|
||||||
|
@ -3056,6 +3057,8 @@ namespace IDE.ui
|
||||||
InsertAtCursor(str);
|
InsertAtCursor(str);
|
||||||
didLineComment = true;
|
didLineComment = true;
|
||||||
maxPos += str.Length;
|
maxPos += str.Length;
|
||||||
|
if (i <= startTextPos + appendedCount)
|
||||||
|
appendedCount += str.Length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mSelection = EditSelection(minPos, maxPos);
|
mSelection = EditSelection(minPos, maxPos);
|
||||||
|
@ -3063,7 +3066,10 @@ namespace IDE.ui
|
||||||
if (undoBatchStart != null)
|
if (undoBatchStart != null)
|
||||||
mData.mUndoManager.Add(undoBatchStart.mBatchEnd);
|
mData.mUndoManager.Add(undoBatchStart.mBatchEnd);
|
||||||
|
|
||||||
CursorLineAndColumn = startLineAndCol;
|
if (appendedCount > 0)
|
||||||
|
CursorTextPos = startTextPos + appendedCount;
|
||||||
|
else
|
||||||
|
CursorLineAndColumn = startLineAndCol;
|
||||||
|
|
||||||
if (!hadSelection)
|
if (!hadSelection)
|
||||||
mSelection = null;
|
mSelection = null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue