cleanup code

This commit is contained in:
Brazly
2026-02-16 21:00:01 +00:00
parent 3684788237
commit e597b86212

View File

@@ -146,20 +146,20 @@ func EnterCommand() -> void:
func MoveCursorLeft(): func MoveCursorLeft():
var full_text = terminalLine.get_parsed_text() var fullText = terminalLine.get_parsed_text()
var last_newline_pos = full_text.rfind("\n") var lastNewlinePos = fullText.rfind("\n")
# The prompt starts after the last newline (or at 0 if it's the first line) # The prompt starts after the last newline (or at 0 if it's the first line)
var prompt_start_index = last_newline_pos + 1 if last_newline_pos != -1 else 0 var promptStartIndex = lastNewlinePos + 1 if lastNewlinePos != -1 else 0
var prompt_length = ("user@work " + directory + " ").length() var promptLength = ("user@work " + directory + " ").length()
# The absolute index we aren't allowed to go before # The absolute index we aren't allowed to go before
var min_allowed_index = prompt_start_index + prompt_length var minAllowedIndex = promptStartIndex + promptLength
# Calculate current target index # Calculate current target index
var current_target = full_text.length() - cursorIndexFromEnd var currentTarget = fullText.length() - cursorIndexFromEnd
if current_target > min_allowed_index: if currentTarget > minAllowedIndex:
cursorIndexFromEnd += 1 cursorIndexFromEnd += 1
UpdateCaretPos() UpdateCaretPos()
ResetBlink() ResetBlink()