From d2c95b8db04a78f53cb454ebc1388fb757cae772 Mon Sep 17 00:00:00 2001 From: bleeptrack Date: Mon, 28 Sep 2020 17:10:21 +0200 Subject: [PATCH] Adding tab to complete shortcut --- project.godot | 5 +++++ terminal.gd | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/project.godot b/project.godot index c830e78..c99c19a 100644 --- a/project.godot +++ b/project.godot @@ -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] diff --git a/terminal.gd b/terminal.gd index 39460d0..6462bc1 100644 --- a/terminal.gd +++ b/terminal.gd @@ -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()