Skip to content

CommandInput ignoring backspace and enter keys #13

Description

@gvvim

(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);
	        }
	}
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions