mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-06 16:25:59 +02:00
Fixed cursor location after line paste undo
This commit is contained in:
parent
a6236eef2c
commit
44c1123637
1 changed files with 7 additions and 5 deletions
|
@ -2085,12 +2085,14 @@ namespace Beefy.widgets
|
||||||
{
|
{
|
||||||
UndoBatchStart undoBatchStart = new UndoBatchStart("paste");
|
UndoBatchStart undoBatchStart = new UndoBatchStart("paste");
|
||||||
mData.mUndoManager.Add(undoBatchStart);
|
mData.mUndoManager.Add(undoBatchStart);
|
||||||
var origPosition = CursorLineAndColumn;
|
|
||||||
CursorLineAndColumn = .(origPosition.mLine, 0);
|
var setCursorAction = new SetCursorAction(this);
|
||||||
|
mData.mUndoManager.Add(setCursorAction);
|
||||||
|
|
||||||
|
var origLineAndColumn = CursorLineAndColumn;
|
||||||
|
CursorLineAndColumn = .(origLineAndColumn.mLine, 0);
|
||||||
var lineStartPosition = CursorLineAndColumn;
|
var lineStartPosition = CursorLineAndColumn;
|
||||||
InsertAtCursor("\n");
|
InsertAtCursor("\n");
|
||||||
if (var insertTextAction = mData.mUndoManager.GetLastUndoAction() as InsertTextAction)
|
|
||||||
insertTextAction.mVirtualCursorPos = origPosition;
|
|
||||||
CursorLineAndColumn = lineStartPosition;
|
CursorLineAndColumn = lineStartPosition;
|
||||||
|
|
||||||
CursorToLineStart(false);
|
CursorToLineStart(false);
|
||||||
|
@ -2109,7 +2111,7 @@ namespace Beefy.widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
PasteText(text);
|
PasteText(text);
|
||||||
CursorLineAndColumn = .(origPosition.mLine + 1, origPosition.mColumn);
|
CursorLineAndColumn = .(origLineAndColumn.mLine + 1, origLineAndColumn.mColumn);
|
||||||
mData.mUndoManager.Add(undoBatchStart.mBatchEnd);
|
mData.mUndoManager.Add(undoBatchStart.mBatchEnd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue