mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 23:36:00 +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");
|
||||
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;
|
||||
InsertAtCursor("\n");
|
||||
if (var insertTextAction = mData.mUndoManager.GetLastUndoAction() as InsertTextAction)
|
||||
insertTextAction.mVirtualCursorPos = origPosition;
|
||||
CursorLineAndColumn = lineStartPosition;
|
||||
|
||||
CursorToLineStart(false);
|
||||
|
@ -2109,7 +2111,7 @@ namespace Beefy.widgets
|
|||
}
|
||||
|
||||
PasteText(text);
|
||||
CursorLineAndColumn = .(origPosition.mLine + 1, origPosition.mColumn);
|
||||
CursorLineAndColumn = .(origLineAndColumn.mLine + 1, origLineAndColumn.mColumn);
|
||||
mData.mUndoManager.Add(undoBatchStart.mBatchEnd);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue