mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-04 12:14:24 +02:00
Format .gd files and fix gdformat pre-commit hook
Previously this hook was not being run.
This commit is contained in:
parent
80bcc41855
commit
302bdf0714
5 changed files with 32 additions and 16 deletions
|
@ -18,7 +18,15 @@ const TITLE_WIDTH = 42
|
|||
|
||||
var menu_items := [
|
||||
{"name": "Asciicast", "scene": preload("../asciicast/asciicast.tscn")},
|
||||
{"name": "Terminal", "scene": preload("../web_console/web_console.tscn") if OS.has_feature("JavaScript") else preload("../terminal/terminal.tscn")},
|
||||
{
|
||||
"name": "Terminal",
|
||||
"scene":
|
||||
(
|
||||
preload("../web_console/web_console.tscn")
|
||||
if OS.has_feature("JavaScript")
|
||||
else preload("../terminal/terminal.tscn")
|
||||
)
|
||||
},
|
||||
{"name": "Exit"}
|
||||
]
|
||||
|
||||
|
@ -140,7 +148,11 @@ func _on_Terminal_key_pressed(data: String, event: InputEventKey) -> void:
|
|||
"Terminal not Supported on Windows"
|
||||
)
|
||||
var scene = item.scene.instance()
|
||||
var pty = scene if OS.has_feature("JavaScript") else scene.get_node("Pseudoterminal")
|
||||
var pty = (
|
||||
scene
|
||||
if OS.has_feature("JavaScript")
|
||||
else scene.get_node("Pseudoterminal")
|
||||
)
|
||||
get_tree().get_root().add_child(scene)
|
||||
visible = false
|
||||
scene.grab_focus()
|
||||
|
|
|
@ -39,17 +39,17 @@ func grab_focus():
|
|||
func _on_Terminal_key_pressed(_data, event: InputEventKey):
|
||||
if not event:
|
||||
return
|
||||
|
||||
|
||||
# For some reason, data String is malformed on HTML5, so only use event.unicode.
|
||||
var data = char(event.unicode)
|
||||
|
||||
|
||||
match event.scancode:
|
||||
KEY_ENTER:
|
||||
terminal.write("\r\n")
|
||||
|
||||
|
||||
if line == "q" or line == "quit" or line == "exit":
|
||||
return emit_signal("exited", 0)
|
||||
|
||||
|
||||
if not _has_js:
|
||||
var msg := "WebConsole only available in HTML5 build."
|
||||
push_error(msg)
|
||||
|
@ -62,11 +62,11 @@ func _on_Terminal_key_pressed(_data, event: InputEventKey):
|
|||
_tput.setaf(TPut.ANSIColor.magenta)
|
||||
terminal.write(str(json))
|
||||
_tput.sgr0()
|
||||
|
||||
|
||||
line = ""
|
||||
#_tput.srg0()
|
||||
prompt("\r\n>> ")
|
||||
|
||||
|
||||
KEY_BACKSPACE:
|
||||
if line.length() > 0:
|
||||
terminal.write("\b \b")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue