Adding tab to complete shortcut

This commit is contained in:
bleeptrack 2020-09-28 17:10:21 +02:00
parent d498c2340b
commit d2c95b8db0
2 changed files with 11 additions and 1 deletions

View file

@ -80,6 +80,11 @@ right_click={
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":2,"pressed":false,"doubleclick":false,"script":null)
]
}
tab_complete={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777218,"unicode":0,"echo":false,"script":null)
]
}
[network]

View file

@ -56,7 +56,12 @@ func _input(event):
input.text = game.state["history"][history_position]
input.caret_position = input.text.length()
get_tree().set_input_as_handled()
if event.is_action_pressed("tab_complete"):
if completions.visible:
completions.get_root().get_children().select(0)
get_tree().set_input_as_handled()
func load_command(id):
input.text = premade_commands[id]
input.caret_position = input.text.length()