Repository navigation
Conversation
The terminal reads key events itself rather than through a text field, so GUIUtility.keyboardControl stayed 0 while typing in it. Mods that check keyboardControl or GUI.GetNameOfFocusedControl() before acting on hotkeys treated terminal keystrokes as hotkeys. The file editor did not have this problem because its TextArea holds keyboard focus. Register a named keyboard control in the terminal window, take keyboard focus with it when the terminal locks, and release it on unlock. Both happen during OnGUI, since setting keyboardControl from Update has no effect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The terminal currently implements "focus" and reads key events directly, so GUIUtility.keyboardControl stays 0 while typing in it. Mods that check keyboardControl or GUI.GetNameOfFocusedControl() before acting on hotkeys don't know kOS has pseudo-focus and so trigger their hotkeys while typing into the terminal. The file editor does not have this problem because its TextArea holds keyboard focus.
This PR registers a named keyboard control in the terminal window, take keyboard focus with it when the terminal locks, and releases it on unlock. Both happen during OnGUI, since setting keyboardControl from Update has no effect.
AI Disclosure This PR code and commit message were written by Claude Opus 5.5. I have reviewed the code and tested in-game, while also drafting Boris-Barboris/AtmosphereAutopilot#52 to fix the other side of the issue for a particular mod. I understand what the code is doing and think it's an appropriate minimal fix here.