From 6aea28e9e948c1e9cdf8453cbf99e0b1a77c873e Mon Sep 17 00:00:00 2001 From: D1GQ Date: Sat, 25 Jul 2026 01:02:14 -0500 Subject: [PATCH] Only allow chat shortcuts when chat is open --- src/Patches/Gameplay/UI/Chat/ChatPatch.cs | 36 +++++++++++++---------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/Patches/Gameplay/UI/Chat/ChatPatch.cs b/src/Patches/Gameplay/UI/Chat/ChatPatch.cs index b0134bb..3ac809a 100644 --- a/src/Patches/Gameplay/UI/Chat/ChatPatch.cs +++ b/src/Patches/Gameplay/UI/Chat/ChatPatch.cs @@ -169,25 +169,29 @@ internal static class ChatPatch __instance.freeChatField.textArea.compoText.Color(Color.black); __instance.freeChatField.textArea.outputText.color = Color.black; } + // Ctrl+x to cut text to clipboard - if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && Input.GetKeyDown(KeyCode.X)) + if (__instance.IsOpenOrOpening) { - ClipboardHelper.PutClipboardString(__instance.freeChatField.textArea.text); - __instance.freeChatField.textArea.SetText(""); - } - // Up arrow for chat history navigation - if (Input.GetKeyDown(KeyCode.UpArrow) && ChatHistory.Any()) - { - CurrentHistorySelection = Mathf.Clamp(--CurrentHistorySelection, 0, ChatHistory.Count - 1); - __instance.freeChatField.textArea.SetText(ChatHistory[CurrentHistorySelection]); - } - // Down arrow for chat history navigation - if (Input.GetKeyDown(KeyCode.DownArrow) && ChatHistory.Any()) - { - CurrentHistorySelection++; - if (CurrentHistorySelection < ChatHistory.Count) + if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && Input.GetKeyDown(KeyCode.X)) + { + ClipboardHelper.PutClipboardString(__instance.freeChatField.textArea.text); + __instance.freeChatField.textArea.SetText(""); + } + // Up arrow for chat history navigation + if (Input.GetKeyDown(KeyCode.UpArrow) && ChatHistory.Any()) + { + CurrentHistorySelection = Mathf.Clamp(--CurrentHistorySelection, 0, ChatHistory.Count - 1); __instance.freeChatField.textArea.SetText(ChatHistory[CurrentHistorySelection]); - else __instance.freeChatField.textArea.SetText(""); + } + // Down arrow for chat history navigation + if (Input.GetKeyDown(KeyCode.DownArrow) && ChatHistory.Any()) + { + CurrentHistorySelection++; + if (CurrentHistorySelection < ChatHistory.Count) + __instance.freeChatField.textArea.SetText(ChatHistory[CurrentHistorySelection]); + else __instance.freeChatField.textArea.SetText(""); + } } } // Log chat messages to console