bugfix: show cursor when past end of line

This commit is contained in:
Kartik K. Agaram 2022-05-19 22:35:26 -07:00
parent 7749e459a7
commit 2f8d727c0b
2 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@ click on first character of text -> cursor on first character of text
click to right of text -> cursor past end of line
click to right of wrapped text -> cursor on final character of line
click on drawing -> cursor doesn't move
cursor past end of line -> renders
create drawing -> cursor bumps down below drawing
backspace
cursor_pos == 0, previous line is a drawing -> delete drawing, cursor still visible at start of line

View File

@ -75,6 +75,11 @@ function Text.draw(line, line_width, line_index, cursor_line, cursor_pos)
x = x + frag_width
pos = pos + frag_len
end
if cursor_pos == pos then
-- cursor
love.graphics.setColor(1,0,0)
love.graphics.circle('fill', x,y+math.floor(15*Zoom), 2)
end
return y
end
-- manual tests: