From b681a03bfbebfaeaec8d6817d07d26e2712b6195 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 21 Oct 2024 13:03:40 +0200 Subject: [PATCH] Fix output log window to properly handle copy and other input events --- Source/Editor/Windows/OutputLogWindow.cs | 24 +++++++++++++++++----- Source/Engine/UI/GUI/Common/TextBoxBase.cs | 7 ++++++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Source/Editor/Windows/OutputLogWindow.cs b/Source/Editor/Windows/OutputLogWindow.cs index 36c6a5c6c..86d0f060d 100644 --- a/Source/Editor/Windows/OutputLogWindow.cs +++ b/Source/Editor/Windows/OutputLogWindow.cs @@ -80,12 +80,9 @@ namespace FlaxEditor.Windows /// public TextBlockStyle ErrorStyle; - /// - public override bool OnKeyDown(KeyboardKeys key) + public OutputTextBox() { - if (Window.InputActions.Process(Editor.Instance, this, key)) - return true; - return base.OnKeyDown(key); + _consumeAllKeyDownEvents = false; } /// @@ -504,6 +501,23 @@ namespace FlaxEditor.Windows } } + /// + public override bool OnKeyDown(KeyboardKeys key) + { + var input = Editor.Options.Options.Input; + if (input.Search.Process(this, key)) + { + if (!_searchBox.ContainsFocus) + { + _searchBox.Focus(); + _searchBox.SelectAll(); + } + return true; + } + + return base.OnKeyDown(key); + } + /// public override bool OnMouseUp(Float2 location, MouseButton button) { diff --git a/Source/Engine/UI/GUI/Common/TextBoxBase.cs b/Source/Engine/UI/GUI/Common/TextBoxBase.cs index 55f810211..021986420 100644 --- a/Source/Engine/UI/GUI/Common/TextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/TextBoxBase.cs @@ -127,6 +127,11 @@ namespace FlaxEngine.GUI /// protected bool _changeCursor = true; + /// + /// True if always return true as default for key events, otherwise won't consume them. + /// + protected bool _consumeAllKeyDownEvents = true; + /// /// Event fired when text gets changed /// @@ -1542,7 +1547,7 @@ namespace FlaxEngine.GUI return false; } - return true; + return _consumeAllKeyDownEvents; } } }