From e789bb37c8a57aaca7bc67e7b8b3b4dc1bbebb3d Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 16 Jul 2019 14:55:41 +0900 Subject: [PATCH] Ignore shift-delete in SearchTextBox --- .../Graphics/UserInterface/SearchTextBox.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 7023711aaa..cd801a3fc9 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -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)