From 2f8d727c0bc220d2f762466ffe9754a6b3d4a6cc Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 19 May 2022 22:35:26 -0700 Subject: bugfix: show cursor when past end of line --- manual_tests | 1 + text.lua | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/manual_tests b/manual_tests index 7871ebf..83a0306 100644 --- a/manual_tests +++ b/manual_tests @@ -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 diff --git a/text.lua b/text.lua index dc9a42a..af3553b 100644 --- a/text.lua +++ b/text.lua @@ -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: -- cgit 1.4.1-2-gfad0