fixed caret issue so it properly tracks
This commit is contained in:
@@ -248,20 +248,14 @@ func GetBottomScroll():
|
||||
func UpdateCaretPos():
|
||||
|
||||
await get_tree().create_timer(.01).timeout
|
||||
var font = terminalLine.get_theme_font("normal_font")
|
||||
var font_size = terminalLine.get_theme_font_size("normal_font_size")
|
||||
var visible_text = terminalLine.get_parsed_text()
|
||||
var lines = visible_text.split("\n")
|
||||
var last_line = lines[-1]
|
||||
var char_rectY = terminalLine.get_content_height()
|
||||
var text_line = TextLine.new()
|
||||
var ruler: Label = $"caret-ruler"
|
||||
|
||||
text_line.width = terminalLine.size.x
|
||||
text_line.flags = TextServer.JUSTIFICATION_NONE
|
||||
text_line.alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
text_line.add_string(last_line, font, font_size)
|
||||
ruler.autowrap_mode =TextServer.AUTOWRAP_WORD_SMART
|
||||
ruler.text = visible_text
|
||||
|
||||
caret.position.x = text_line.get_line_width()
|
||||
caret.position.y = char_rectY - 50
|
||||
var last_char_index = ruler.text.length() - 1
|
||||
var char_rect = ruler.get_character_bounds(max(0, last_char_index))
|
||||
caret.position.x = char_rect.end.x + 1
|
||||
caret.position.y = terminalLine.get_content_height() - 50
|
||||
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user