Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommandInput ignoring backspace and enter keys #13

Open
bitegw opened this issue Nov 20, 2024 · 0 comments
Open

CommandInput ignoring backspace and enter keys #13

bitegw opened this issue Nov 20, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@bitegw
Copy link

bitegw commented Nov 20, 2024

(Godot v4.2.2)

Seems to be related to this issue with Godot engine.
But the only way to fix it that I've found is to manually check for these events so I'm sharing the fix here, in case someone else runs into this issue.

Add this to _EnterTree in Console.cs:

_commandInput.GuiInput += (InputEvent @event) =>
{
	if (@event is InputEventKey key && key.Pressed)
	{
	        if (key.Keycode == Key.Backspace)
	        {
		        _commandInput.DeleteText(_commandInput.CaretColumn - 1, _commandInput.CaretColumn);
	        }
	        else if (key.Keycode == Key.Enter)
	        {
		        ProcessCommand(_commandInput.Text);
	        }
	}
};
@LauraWebdev LauraWebdev self-assigned this Nov 20, 2024
@LauraWebdev LauraWebdev added the bug Something isn't working label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants