optimised code and made help command easier to read

This commit is contained in:
Brazly
2026-01-24 14:12:21 +00:00
parent 606e203b93
commit 53254ab87b
2 changed files with 14 additions and 12 deletions

View File

@@ -46,14 +46,14 @@ func InputChar(input) -> void:
command = input
terminalLine.text += command
UpdateCaretPos()
await get_tree().create_timer(.01).timeout
await get_tree().physics_frame
reset_blink()
func InputDelChar() -> void:
if terminalLine.text.length() > ("user@work " + directory).length() + 1:
terminalLine.text = terminalLine.text.left(-1)
UpdateCaretPos()
await get_tree().create_timer(.01).timeout
await get_tree().physics_frame
reset_blink()
func EnterCommand() -> void:
@@ -191,23 +191,24 @@ func RetrieveData(inputPath: String):
func Help(commandName: String = "default"):
match commandName:
"default": CreateHistoryEntry("--- AVAILABLE COMMANDS ---
ls (or list) [folder] : List all files and directories/folders
cd [folder] : Change directory (use '..' to go up a directory/folder)
cat (or view) [file] : Read the contents of a file
clear (or cls) : Clear the terminal screen
help : Show this menu
-------------------------")
"default": CreateHistoryEntry("--- AVAILABLE COMMANDS --- \n
ls (or list) [folder] ------------ : List all files and directories/folders
cd [folder] ---------------------- : Change directory (use '..' to go up a directory/folder)
cat (or view) [file] ------------- : Read the contents of a file
clear (or cls) ------------------- : Clear the terminal screen
help ----------------------------- : Show this menu
\n
")
func ScrollUp():
await get_tree().create_timer(.0001).timeout
await get_tree().physics_frame
scroll.set_deferred("scroll_vertical", scroll.get_v_scroll_bar().value - 100 )
func ScrollDown():
await get_tree().create_timer(.0001).timeout
await get_tree().physics_frame
scroll.set_deferred("scroll_vertical", scroll.get_v_scroll_bar().value + 100 )
@@ -220,7 +221,7 @@ func GetBottomScroll():
func UpdateCaretPos():
await get_tree().create_timer(.05).timeout
await get_tree().physics_frame
var visible_text = terminalLine.get_parsed_text()
ruler.autowrap_mode =TextServer.AUTOWRAP_WORD_SMART