diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-06-13 17:23:21 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-06-14 08:02:25 -0700 |
commit | e20935ad7a6a18e901200eac1ac7cdcedcc7a1dc (patch) | |
tree | 6c365831238ec56f209026d9c6fb25cfcf0a888e /main.lua | |
parent | 9b0577f79eb87be1d2f3a8af09dc9830b14e63c1 (diff) | |
download | text.love-e20935ad7a6a18e901200eac1ac7cdcedcc7a1dc.tar.gz |
bugfix
manifestation: clicking past end of a long, wrapping line containing non-ASCII would cause the cursor to disappear rather than position past end of screen line. Hitting enter would then throw an assertion with the following stack trace: Error: text.lua:381: bad argument #2 to 'sub' (number expected, got nil) stack traceback: [love "boot.lua"]:345: in function <[love "boot.lua"]:341> [C]: in function 'sub' text.lua:381: in function 'insert_return' text.lua:179: in function 'keychord_pressed' main.lua:495: in function 'keychord_pressed' keychord.lua:10: in function <keychord.lua:5> app.lua:34: in function <app.lua:25> [C]: in function 'xpcall' cause: the click caused a call to Text.to_pos_on_line whose result was not on a UTF-8 character boundary. fix: make to_pos_on_line utf8-aware.
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/main.lua b/main.lua index 6adf53c..873a4cd 100644 --- a/main.lua +++ b/main.lua @@ -86,6 +86,8 @@ Last_resize_time = nil -- blinking cursor Cursor_time = 0 +Quit = false + end -- App.initialize_globals function App.initialize(arg) @@ -101,6 +103,7 @@ function App.initialize(arg) end initialize_font_settings(20) +--? Line_width = 80 if #arg > 0 then Filename = arg[1] @@ -122,6 +125,8 @@ function App.initialize(arg) jit.off() jit.flush() end + + Quit = true end -- App.initialize function initialize_window_geometry(geometry_spec) @@ -258,6 +263,8 @@ function App.draw() if Search_term then Text.draw_search_bar() end + +--? if Quit then os.exit(1) end end function App.update(dt) @@ -319,6 +326,7 @@ function App.mousereleased(x,y, button) if line.mode == 'text' then if Text.in_line(line_index,line, x,y) then Cursor1 = {line=line_index, pos=Text.to_pos_on_line(line, x, y)} +--? print(Cursor1.line, Cursor1.pos) if Mousepress_shift then if Old_selection1.line == nil then Selection1 = Old_cursor1 |