mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-13 05:44:11 +02:00
Fixed line paste indent issues
This commit is contained in:
parent
a700a6bbd2
commit
2a57d9d447
2 changed files with 36 additions and 24 deletions
|
@ -2054,6 +2054,8 @@ namespace Beefy.widgets
|
|||
CursorLineAndColumn = .(origPosition.mLine, 0);
|
||||
var lineStartPosition = CursorLineAndColumn;
|
||||
InsertAtCursor("\n");
|
||||
if (var insertTextAction = mData.mUndoManager.GetLastUndoAction() as InsertTextAction)
|
||||
insertTextAction.mVirtualCursorPos = origPosition;
|
||||
CursorLineAndColumn = lineStartPosition;
|
||||
CursorToLineStart(false);
|
||||
|
||||
|
@ -2071,7 +2073,7 @@ namespace Beefy.widgets
|
|||
}
|
||||
|
||||
PasteText(text);
|
||||
CursorLineAndColumn = origPosition;
|
||||
CursorLineAndColumn = .(origPosition.mLine + 1, origPosition.mColumn);
|
||||
mData.mUndoManager.Add(undoBatchStart.mBatchEnd);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1230,7 +1230,25 @@ namespace IDE.ui
|
|||
|
||||
var lineAndColumn = CursorLineAndColumn;
|
||||
var lineText = scope String();
|
||||
|
||||
bool startsWithNewline = (forceMatchIndent) && (str.StartsWith("\n"));
|
||||
bool isMultiline = str.Contains("\n");
|
||||
|
||||
if (startsWithNewline || isMultiline)
|
||||
{
|
||||
var undoBatchStart = new UndoBatchStart("pasteText");
|
||||
mData.mUndoManager.Add(undoBatchStart);
|
||||
defer(stack) mData.mUndoManager.Add(undoBatchStart.mBatchEnd);
|
||||
}
|
||||
|
||||
if (HasSelection())
|
||||
{
|
||||
if (isMultiline)
|
||||
{
|
||||
DeleteSelection();
|
||||
lineAndColumn = CursorLineAndColumn;
|
||||
}
|
||||
else
|
||||
{
|
||||
int startPos;
|
||||
int endPos;
|
||||
|
@ -1249,19 +1267,11 @@ namespace IDE.ui
|
|||
|
||||
ExtractString(lineStart, startPos - lineStart, lineText);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetLineText(lineAndColumn.mLine, lineText);
|
||||
}
|
||||
|
||||
bool startsWithNewline = (forceMatchIndent) && (str.StartsWith("\n"));
|
||||
bool isMultiline = str.Contains("\n");
|
||||
|
||||
if (startsWithNewline || isMultiline)
|
||||
if (lineText.IsEmpty)
|
||||
{
|
||||
var undoBatchStart = new UndoBatchStart("pasteText");
|
||||
mData.mUndoManager.Add(undoBatchStart);
|
||||
defer(stack) mData.mUndoManager.Add(undoBatchStart.mBatchEnd);
|
||||
GetLineText(lineAndColumn.mLine, lineText);
|
||||
}
|
||||
|
||||
if (startsWithNewline)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue