Ignore shift-delete in SearchTextBox

This commit is contained in:
David Zhao 2019-07-16 14:55:41 +09:00
parent 60adac23b4
commit e789bb37c8
1 changed files with 18 additions and 0 deletions

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;
@ -15,6 +16,8 @@ public class SearchTextBox : FocusedTextBox
public override bool HandleLeftRightArrows => false;
private InputManager inputManager;
public SearchTextBox()
{
Height = 35;
@ -33,6 +36,21 @@ public SearchTextBox()
PlaceholderText = "type to search";
}
protected override void LoadComplete()
{
inputManager = GetContainingInputManager();
base.LoadComplete();
}
protected override bool HandleAction(PlatformAction action)
{
// Allow shift-delete to be handled locally
if (inputManager.CurrentState.Keyboard.ShiftPressed && action.ActionType == PlatformActionType.CharNext && action.ActionMethod == PlatformActionMethod.Delete)
return false;
return base.HandleAction(action);
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (!e.ControlPressed && !e.ShiftPressed)