From ee404dea955670f2d1e8fda91154e3a846fd003f Mon Sep 17 00:00:00 2001 From: Anna Date: Mon, 22 Jul 2024 13:44:56 -0400 Subject: [PATCH] feat: add missing search --- client/Ui/MainWindowTabs/Write.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/client/Ui/MainWindowTabs/Write.cs b/client/Ui/MainWindowTabs/Write.cs index b80997c..ea6d968 100644 --- a/client/Ui/MainWindowTabs/Write.cs +++ b/client/Ui/MainWindowTabs/Write.cs @@ -178,6 +178,13 @@ internal class Write : ITab { using var endCombo = new OnDispose(ImGui.EndCombo); + if (ImGui.IsWindowAppearing()) { + ImGui.SetKeyboardFocusHere(); + } + + ImGui.SetNextItemWidth(-1); + ImGui.InputTextWithHint("###word-search", "Search...", ref search, 100, ImGuiInputTextFlags.AutoSelectAll); + for (var wordIdx = 0; wordIdx < template.Words.Length; wordIdx++) { var word = template.Words[wordIdx]; if (!string.IsNullOrEmpty(search) && !word.Contains(search, StringComparison.InvariantCultureIgnoreCase)) { @@ -206,7 +213,12 @@ internal class Write : ITab { using var endMenu = new OnDispose(ImGui.EndMenu); - ImGui.InputText("###word-search", ref search, 100); + if (ImGui.IsWindowAppearing()) { + ImGui.SetKeyboardFocusHere(); + } + + ImGui.SetNextItemWidth(-1); + ImGui.InputTextWithHint("###word-search", "Search...", ref search, 100, ImGuiInputTextFlags.AutoSelectAll); for (var wordIdx = 0; wordIdx < list.Words.Length; wordIdx++) { var word = list.Words[wordIdx];