Input line grabs focus when text editor closes

This commit is contained in:
Sebastian Morr 2020-09-21 18:59:55 +02:00
parent 6cd68f3599
commit ba55f64118
2 changed files with 7 additions and 4 deletions

View File

@ -24,8 +24,8 @@ func _ready():
for command in premade_commands:
command_dropdown.get_popup().add_item(command)
command_dropdown.get_popup().connect("id_pressed", self, "load_command")
command_dropdown.theme = Theme.new()
command_dropdown.theme.default_font = load("res://fonts/default.tres")
$TextEditor.connect("hide", self, "editor_closed")
#func _input(event):
# if history.size() > 0:
@ -78,6 +78,9 @@ func receive_output(text):
func clear():
output.text = ""
func editor_closed():
input.grab_focus()
func check_win_condition():
if repository.shell.run("bash /tmp/win 2>/dev/null >/dev/null && echo yes || echo no") == "yes\n":
main.show_win_status()

View File

@ -5,7 +5,7 @@
[ext_resource path="res://fonts/monospace.tres" type="DynamicFont" id=4]
[ext_resource path="res://text_editor.tscn" type="PackedScene" id=5]
[sub_resource type="StyleBoxFlat" id=2]
[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 5.0
content_margin_right = 5.0
content_margin_top = 5.0
@ -34,7 +34,7 @@ __meta__ = {
margin_right = 1920.0
margin_bottom = 1049.0
size_flags_vertical = 3
custom_styles/normal = SubResource( 2 )
custom_styles/normal = SubResource( 1 )
custom_fonts/normal_font = ExtResource( 4 )
scroll_following = true