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-19 22:07:12 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-19 22:07:12 -0700
commitd4daac442b805eb1a4b3e1fb3edd993359eae31a (patch)
tree91a63726cb44710db091a10eb0e937a9ac09aee3 /main.lua
parent4fb4e0eb259367740b1e82fdc1161e39af93e87e (diff)
downloadlines.love-d4daac442b805eb1a4b3e1fb3edd993359eae31a.tar.gz
clicking now moves the cursor even on long, wrapped lines
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.lua b/main.lua
index d058e53..0cd5274 100644
--- a/main.lua
+++ b/main.lua
@@ -12,6 +12,7 @@ require 'icons'
 -- a text is a table with:
 --    mode = 'text'
 --    string data
+--    screen_line_starting_pos: optional array of grapheme indices if it wraps over more than one screen line
 -- a drawing is a table with:
 --    mode = 'drawing'
 --    a (y) coord in pixels (updated while painting screen),
@@ -126,7 +127,6 @@ function love.draw()
         y = y + Drawing.pixels(line.h) + 10 -- padding
       else
         line.y = y
---?         y = Text.draw(line, 100, line_index, Cursor_line, Cursor_pos)
         y = Text.draw(line, Line_width, line_index, Cursor_line, Cursor_pos)
         y = y + math.floor(15*Zoom)  -- text height
       end
@@ -145,7 +145,7 @@ function love.mousepressed(x,y, mouse_button)
   for line_index,line in ipairs(Lines) do
     if line.mode == 'text' then
       if Text.in_line(line, x,y) then
-        Text.move_cursor(line_index, line, x)
+        Text.move_cursor(line_index, line, x, y)
       end
     elseif line.mode == 'drawing' then
       if Drawing.in_drawing(line, x, y) then