mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-11 12:54:15 +02:00
IDE text undo/redo fix
This commit is contained in:
parent
8e191b074b
commit
06f8b250fc
1 changed files with 14 additions and 0 deletions
|
@ -330,6 +330,8 @@ namespace Beefy.widgets
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mSelection.ValueRef.mEndPos = insertTextAction.mSelection.Value.mEndPos;
|
mSelection.ValueRef.mEndPos = insertTextAction.mSelection.Value.mEndPos;
|
||||||
|
if (!mSelection.Value.HasSelection)
|
||||||
|
mSelection = null;
|
||||||
mSelectionText.Append(insertTextAction.mSelectionText);
|
mSelectionText.Append(insertTextAction.mSelectionText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,6 +350,9 @@ namespace Beefy.widgets
|
||||||
|
|
||||||
public override bool Undo()
|
public override bool Undo()
|
||||||
{
|
{
|
||||||
|
if (mSelection != null)
|
||||||
|
Debug.Assert(mSelection.Value.HasSelection);
|
||||||
|
|
||||||
var editWidgetContent = EditWidgetContent;
|
var editWidgetContent = EditWidgetContent;
|
||||||
int startIdx = (mSelection != null) ? mSelection.Value.MinPos : mCursorTextPos;
|
int startIdx = (mSelection != null) ? mSelection.Value.MinPos : mCursorTextPos;
|
||||||
editWidgetContent.RemoveText(startIdx, (int32)mText.Length);
|
editWidgetContent.RemoveText(startIdx, (int32)mText.Length);
|
||||||
|
@ -2677,6 +2682,15 @@ namespace Beefy.widgets
|
||||||
mCursorBlinkTicks++;
|
mCursorBlinkTicks++;
|
||||||
if (mEditWidget.mHasFocus)
|
if (mEditWidget.mHasFocus)
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
|
|
||||||
|
if (!mData.mUndoManager.[Friend]mUndoList.IsEmpty)
|
||||||
|
{
|
||||||
|
if (var textInsertAction = mData.mUndoManager.[Friend]mUndoList.Back as InsertTextAction)
|
||||||
|
{
|
||||||
|
if (textInsertAction.mSelection != null)
|
||||||
|
Debug.Assert(textInsertAction.mSelection.Value.HasSelection);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void RecalcSize()
|
public virtual void RecalcSize()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue