1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-14 14:24:10 +02:00

Fixed some selection issues

This commit is contained in:
Brian Fiete 2020-07-19 11:07:31 -07:00
parent 1e446a655c
commit af9ac0b918

View file

@ -525,7 +525,8 @@ namespace Beefy.widgets
{ {
None, None,
Dragging, Dragging,
ClickedInside ClickedInside,
DraggingInside
} }
public Data mData ~ _.Deref(this); public Data mData ~ _.Deref(this);
@ -798,7 +799,7 @@ namespace Beefy.widgets
} }
else if (!mWidgetWindow.IsKeyDown(KeyCode.Shift)) else if (!mWidgetWindow.IsKeyDown(KeyCode.Shift))
{ {
if ((mSelection != null) && (CursorTextPos >= mSelection.Value.MinPos) && (CursorTextPos <= mSelection.Value.MaxPos)) if ((mSelection != null) && (CursorTextPos > mSelection.Value.MinPos) && (CursorTextPos < mSelection.Value.MaxPos))
{ {
if (hadSelection) if (hadSelection)
{ {
@ -836,6 +837,8 @@ namespace Beefy.widgets
ClampCursor(); ClampCursor();
if (mDragSelectionKind == .Dragging) if (mDragSelectionKind == .Dragging)
SelectToCursor(); SelectToCursor();
else if (mDragSelectionKind == .ClickedInside)
mDragSelectionKind = .DraggingInside;
} }
} }
@ -2004,15 +2007,19 @@ namespace Beefy.widgets
{ {
String selText = scope String(); String selText = scope String();
GetSelectionText(selText); GetSelectionText(selText);
if (!selText.IsEmpty)
{
BFApp.sApp.SetClipboardText(selText); BFApp.sApp.SetClipboardText(selText);
DeleteSelection(); DeleteSelection();
} }
} }
}
public void CopyText() public void CopyText()
{ {
String selText = scope String(); String selText = scope String();
GetSelectionText(selText); GetSelectionText(selText);
if (!selText.IsEmpty)
BFApp.sApp.SetClipboardText(selText); BFApp.sApp.SetClipboardText(selText);
} }