SofiaConsole
SofiaConsole copied to clipboard
CommandInput ignoring backspace and enter keys
(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);
}
}
};