about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-16 21:36:44 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-16 21:36:44 -0700
commit741018db1f1ceca00b1a0b471c58115334db4502 (patch)
treed179e115a6088c4638d8a45f60eadcb9027a0970
parent5a4b8451ce01efca0f37d55c9668296136fbc3c5 (diff)
downloadtext.love-741018db1f1ceca00b1a0b471c58115334db4502.tar.gz
bugfix: up/down across drawings
-rw-r--r--main.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/main.lua b/main.lua
index 2656477..6992a61 100644
--- a/main.lua
+++ b/main.lua
@@ -710,12 +710,14 @@ function keychord_pressed(chord)
 end
 
 function cursor_x(line, cursor_pos)
+  if type(line) == 'table' then return 0 end
   local line_before_cursor = line:sub(1, cursor_pos-1)
   local text_before_cursor = love.graphics.newText(love.graphics.getFont(), line_before_cursor)
   return text_before_cursor:getWidth()
 end
 
 function nearest_cursor_pos(line, x, hint)
+  if type(line) == 'table' then return hint end
   if x == 0 then
     return 1
   end