1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 07:22:54 +08:00

Ignore shift-delete PlatformAction in SearchTextBox (#5372)

Ignore shift-delete PlatformAction in SearchTextBox

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert 2019-07-23 17:11:09 +09:00 committed by GitHub
commit 9665a94f4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Framework.Input.Events;
using osuTK;
using osuTK.Input;
@ -33,6 +34,17 @@ namespace osu.Game.Graphics.UserInterface
PlaceholderText = "type to search";
}
public override bool OnPressed(PlatformAction action)
{
// Shift+delete is handled via PlatformAction on macOS. this is not so useful in the context of a SearchTextBox
// as we do not allow arrow key navigation in the first place (ie. the care should always be at the end of text)
// Avoid handling it here to allow other components to potentially consume the shortcut.
if (action.ActionType == PlatformActionType.CharNext && action.ActionMethod == PlatformActionMethod.Delete)
return false;
return base.OnPressed(action);
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (!e.ControlPressed && !e.ShiftPressed)