bugfix: up/down across drawings

This commit is contained in:
Kartik K. Agaram 2022-05-16 21:36:44 -07:00
parent 5a4b8451ce
commit 741018db1f
1 changed files with 2 additions and 0 deletions

View File

@ -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