From b51b743df49a4a000b45ac1752d3c90558e60528 Mon Sep 17 00:00:00 2001 From: Sinai Date: Wed, 26 May 2021 17:41:38 +1000 Subject: [PATCH] Prevent very niche recursion situation --- src/UI/CSConsole/ConsoleController.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/UI/CSConsole/ConsoleController.cs b/src/UI/CSConsole/ConsoleController.cs index 376d9c9..5b7f2a2 100644 --- a/src/UI/CSConsole/ConsoleController.cs +++ b/src/UI/CSConsole/ConsoleController.cs @@ -248,6 +248,8 @@ namespace UnityExplorer.UI.CSConsole UpdateCaret(out _); } + private static float timeOfLastCtrlR; + public static void Update() { if (SRENotSupported) @@ -269,8 +271,10 @@ namespace UnityExplorer.UI.CSConsole if (EnableCtrlRShortcut && (InputManager.GetKey(KeyCode.LeftControl) || InputManager.GetKey(KeyCode.RightControl)) - && InputManager.GetKeyDown(KeyCode.R)) + && InputManager.GetKeyDown(KeyCode.R) + && timeOfLastCtrlR.OccuredEarlierThanDefault()) { + timeOfLastCtrlR = Time.realtimeSinceStartup; Evaluate(Panel.Input.Text); } }