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 17:46:02 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-19 17:46:02 -0700
commitf7ff4dc9c270520860f0879d317dcf2fad5f77ec (patch)
tree3471d66316b39f6da4e47aba956e6b74e0f5fa9e /main.lua
parenta9398e499be6ae98c14ff6e798c50f83d0495906 (diff)
downloadtext.love-f7ff4dc9c270520860f0879d317dcf2fad5f77ec.tar.gz
eliminate assumptions that line length == size in bytes
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/main.lua b/main.lua
index 702af42..a4eb1c8 100644
--- a/main.lua
+++ b/main.lua
@@ -44,7 +44,7 @@ Cursor_line = 1
 --  ^cursor_pos = 2
 --   ...
 --               ^cursor_pos past end of line is 15
-Cursor_pos = #Lines[Cursor_line].data+1  -- in Unicode codepoints
+Cursor_pos = 1  -- in Unicode codepoints
 
 Screen_width, Screen_height, Screen_flags = 0, 0, nil
 
@@ -133,8 +133,8 @@ 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, Drawing_width, line_index, Cursor_line, Cursor_pos)
+--?         y = Text.draw(line, 100, line_index, Cursor_line, Cursor_pos)
+        y = Text.draw(line, Drawing_width, line_index, Cursor_line, Cursor_pos)
         y = y + math.floor(15*Zoom)  -- text height
       end
     end