Skip to content

Commit

Permalink
Merge pull request #5997 from peppy/dont-block-cut-on-empty-textbox-s…
Browse files Browse the repository at this point in the history
…election

Don't block cut/copy platform actions on empty textbox selection
  • Loading branch information
smoogipoo authored Sep 21, 2023
2 parents 95c66c8 + 45fcd9e commit 2cb33d7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions osu.Framework/Graphics/UserInterface/TextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,15 @@ public virtual bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
// Clipboard
case PlatformAction.Cut:
case PlatformAction.Copy:
if (string.IsNullOrEmpty(SelectedText) || !AllowClipboardExport) return true;
if (!AllowClipboardExport) return false;

clipboard.SetText(SelectedText);
if (!string.IsNullOrEmpty(SelectedText))
{
clipboard.SetText(SelectedText);

if (e.Action == PlatformAction.Cut)
DeleteBy(0);
if (e.Action == PlatformAction.Cut)
DeleteBy(0);
}

return true;

Expand Down

0 comments on commit 2cb33d7

Please sign in to comment.