changed it so help message doesnt go off screen when typing commands rapidly. Does make it look a bit weird though

This commit is contained in:
Brazly
2026-01-17 22:57:23 +00:00
parent 129309ec3e
commit 0247e53de7

View File

@@ -57,10 +57,10 @@ func InputDelChar() -> void:
func EnterCommand() -> void: func EnterCommand() -> void:
var fullText = terminalLine.text var fullText = terminalLine.text
var userInput = fullText.trim_prefix("user@work " + directory).strip_edges() var userInput = fullText.trim_prefix("user@work " + directory).strip_edges()
var parts = userInput.to_lower().split(" ")
if historyContainer.get_child_count() <22: if historyContainer.get_child_count() <22:
CreateHistoryEntry(fullText) CreateHistoryEntry(fullText)
var parts = userInput.to_lower().split(" ")
match parts[0]: match parts[0]:
"ls", "list": "ls", "list":
@@ -116,16 +116,16 @@ func CreateHistoryEntry(content: String) -> void:
label.label_settings.font_size = 42 label.label_settings.font_size = 42
label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
label.custom_minimum_size = Vector2(1400, 0) label.custom_minimum_size = Vector2(1400, 0)
#
if terminalLine.text.length() > 200: #if terminalLine.text.length() > 200:
for child in historyContainer.get_children(): #for child in historyContainer.get_children():
if child != terminalLine: #if child != terminalLine:
child.queue_free() #child.queue_free()
historyContainer.add_child(label) historyContainer.add_child(label)
historyContainer.move_child(label, historyContainer.get_child_count() - 2) historyContainer.move_child(label, historyContainer.get_child_count() - 2)
# Limit history to 15 entries + 1 active line # Limit history to 15 entries + 1 active line
if historyContainer.get_child_count() > 22: if historyContainer.get_child_count() > 17:
historyContainer.get_child(0).queue_free() historyContainer.get_child(0).queue_free()
func ResolvePath(current: String, target: String) -> String: func ResolvePath(current: String, target: String) -> String: