keyremapping: add option to remap space in dialog

This commit is contained in:
Tinus Flagstad
2020-05-24 22:44:33 +02:00
committed by GitHub
parent a54374e931
commit 8d62ba9416
2 changed files with 16 additions and 0 deletions

View File

@@ -241,4 +241,15 @@ public interface KeyRemappingConfig extends Config
{
return new ModifierlessKeybind(KeyEvent.VK_ESCAPE, 0);
}
@ConfigItem(
position = 20,
keyName = "space",
name = "Space",
description = "The key which will replace {Space} when dialogs are open."
)
default ModifierlessKeybind space()
{
return new ModifierlessKeybind(KeyEvent.VK_SPACE, 0);
}
}

View File

@@ -156,6 +156,11 @@ class KeyRemappingListener implements KeyListener
}
}
if (plugin.isDialogOpen() && config.space().matches(e))
{
mappedKeyCode = KeyEvent.VK_SPACE;
}
if (mappedKeyCode != KeyEvent.VK_UNDEFINED && mappedKeyCode != e.getKeyCode())
{
final char keyChar = e.getKeyChar();