mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-03 19:04:40 +01:00
shortcut to delete words in terminal
This commit is contained in:
parent
c400653f9d
commit
e7404200dd
2 changed files with 15 additions and 0 deletions
|
@ -111,6 +111,11 @@ save={
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
delete_word={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[network]
|
[network]
|
||||||
|
|
||||||
|
|
10
terminal.gd
10
terminal.gd
|
@ -70,6 +70,16 @@ func _input(event):
|
||||||
if completions.visible:
|
if completions.visible:
|
||||||
completions.get_root().get_children().select(0)
|
completions.get_root().get_children().select(0)
|
||||||
get_tree().set_input_as_handled()
|
get_tree().set_input_as_handled()
|
||||||
|
if event.is_action_pressed("delete_word"):
|
||||||
|
var first_half = input.text.substr(0,input.caret_position)
|
||||||
|
var second_half = input.text.substr(input.caret_position)
|
||||||
|
|
||||||
|
var idx = first_half.strip_edges(false, true).find_last(" ")
|
||||||
|
if idx > 0:
|
||||||
|
input.text = first_half.substr(0,idx+1) + second_half
|
||||||
|
input.caret_position = idx+1
|
||||||
|
else:
|
||||||
|
input.text = "" + second_half
|
||||||
|
|
||||||
func load_command(id):
|
func load_command(id):
|
||||||
input.text = premade_commands[id]
|
input.text = premade_commands[id]
|
||||||
|
|
Loading…
Reference in a new issue