about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-16 21:35:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-16 21:35:19 -0700
commit5a4b8451ce01efca0f37d55c9668296136fbc3c5 (patch)
treec60bbbc03afda2ad720f471206a6970e2d5a132d /main.lua
parentc06e744feb17ba90caa7ac92f668cfeb37060c67 (diff)
downloadtext.love-5a4b8451ce01efca0f37d55c9668296136fbc3c5.tar.gz
show cursor even on empty lines
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index 742c048..2656477 100644
--- a/main.lua
+++ b/main.lua
@@ -102,6 +102,10 @@ function love.draw()
         onpress1 = function()
                      table.insert(lines, i, {y=y, h=256/2, points={}, shapes={}, pending={}})
                    end})
+        if i == cursor_line then
+          love.graphics.setColor(0,0,0)
+          love.graphics.print('_', 25, y+6)  -- drop the cursor down a bit to account for the increased font size
+        end
     elseif type(line) == 'table' then
       -- line drawing
       line.y = y
@@ -156,7 +160,6 @@ function love.draw()
       love.graphics.draw(text, 25,y, 0, 1.5)
       if i == cursor_line then
         -- cursor
-        love.graphics.setColor(0,0,0)
         love.graphics.print('_', 25+cursor_x(lines[cursor_line], cursor_pos)*1.5, y+6)  -- drop the cursor down a bit to account for the increased font size
       end
     end