mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-03 19:04:40 +01:00
Close all open editors when running a terminal command
This is a first workaround for the problem that editors are sometimes out of date. The UI around these will probably continue to change significantly. Closes #7.
This commit is contained in:
parent
0e2cacabce
commit
9a9541a858
3 changed files with 11 additions and 2 deletions
|
@ -4,7 +4,9 @@
|
||||||
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=2]
|
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=2]
|
||||||
[ext_resource path="res://styles/theme.tres" type="Theme" id=3]
|
[ext_resource path="res://styles/theme.tres" type="Theme" id=3]
|
||||||
|
|
||||||
[node name="FileBrowser" type="Control"]
|
[node name="FileBrowser" type="Control" groups=[
|
||||||
|
"editors",
|
||||||
|
]]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
rect_min_size = Vector2( 0, 142 )
|
rect_min_size = Vector2( 0, 142 )
|
||||||
|
|
|
@ -72,6 +72,7 @@ func load_command(id):
|
||||||
input.caret_position = input.text.length()
|
input.caret_position = input.text.length()
|
||||||
|
|
||||||
func send_command(command):
|
func send_command(command):
|
||||||
|
close_all_editors()
|
||||||
game.state["history"].push_back(command)
|
game.state["history"].push_back(command)
|
||||||
game.save_state()
|
game.save_state()
|
||||||
history_position = game.state["history"].size()
|
history_position = game.state["history"].size()
|
||||||
|
@ -206,3 +207,7 @@ func _completion_selected():
|
||||||
|
|
||||||
func editor_saved():
|
func editor_saved():
|
||||||
emit_signal("command_done")
|
emit_signal("command_done")
|
||||||
|
|
||||||
|
func close_all_editors():
|
||||||
|
for editor in get_tree().get_nodes_in_group("editors"):
|
||||||
|
editor.close()
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=1]
|
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=1]
|
||||||
[ext_resource path="res://scenes/text_editor.gd" type="Script" id=2]
|
[ext_resource path="res://scenes/text_editor.gd" type="Script" id=2]
|
||||||
|
|
||||||
[node name="TextEditor" type="TextEdit"]
|
[node name="TextEditor" type="TextEdit" groups=[
|
||||||
|
"editors",
|
||||||
|
]]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
custom_colors/background_color = Color( 0, 0, 0, 1 )
|
custom_colors/background_color = Color( 0, 0, 0, 1 )
|
||||||
|
|
Loading…
Reference in a new issue