cleanup code
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user