From 4161e8e3788e6f7c783e3f0ca3318f8c8002bd0a Mon Sep 17 00:00:00 2001 From: Infi Date: Wed, 1 May 2024 22:56:52 +0200 Subject: [PATCH] Set chat input to readonly on disabled tabs --- ChatTwo/ChatTwo.csproj | 2 +- ChatTwo/Ui/ChatLogWindow.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChatTwo/ChatTwo.csproj b/ChatTwo/ChatTwo.csproj index 011228c..4f5b547 100755 --- a/ChatTwo/ChatTwo.csproj +++ b/ChatTwo/ChatTwo.csproj @@ -1,6 +1,6 @@ - 1.23.2 + 1.23.3 net8.0-windows enable enable diff --git a/ChatTwo/Ui/ChatLogWindow.cs b/ChatTwo/Ui/ChatLogWindow.cs index facfe5c..ff0942d 100644 --- a/ChatTwo/Ui/ChatLogWindow.cs +++ b/ChatTwo/Ui/ChatLogWindow.cs @@ -664,8 +664,11 @@ public sealed class ChatLogWindow : Window var isChatEnabled = activeTab is { InputDisabled: false }; using (ImRaii.Disabled(!isChatEnabled)) { + // TODO: Prevent ENTER key focusing chat while input is disabled + + var flags = InputFlags | (!isChatEnabled ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.None); ImGui.SetNextItemWidth(inputWidth); - ImGui.InputTextWithHint("##chat2-input", isChatEnabled ? "": Language.ChatLog_DisabledInput, ref Chat, 500, InputFlags, Callback); + ImGui.InputTextWithHint("##chat2-input", isChatEnabled ? "": Language.ChatLog_DisabledInput, ref Chat, 500, flags, Callback); } if (ImGui.IsItemDeactivated())