bugfix: up/down across drawings
This commit is contained in:
parent
5a4b8451ce
commit
741018db1f
2
main.lua
2
main.lua
|
@ -710,12 +710,14 @@ function keychord_pressed(chord)
|
||||||
end
|
end
|
||||||
|
|
||||||
function cursor_x(line, cursor_pos)
|
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 line_before_cursor = line:sub(1, cursor_pos-1)
|
||||||
local text_before_cursor = love.graphics.newText(love.graphics.getFont(), line_before_cursor)
|
local text_before_cursor = love.graphics.newText(love.graphics.getFont(), line_before_cursor)
|
||||||
return text_before_cursor:getWidth()
|
return text_before_cursor:getWidth()
|
||||||
end
|
end
|
||||||
|
|
||||||
function nearest_cursor_pos(line, x, hint)
|
function nearest_cursor_pos(line, x, hint)
|
||||||
|
if type(line) == 'table' then return hint end
|
||||||
if x == 0 then
|
if x == 0 then
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue