diff options
Diffstat (limited to 'text.lua')
-rw-r--r-- | text.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/text.lua b/text.lua index 82b4ab8..9db8b16 100644 --- a/text.lua +++ b/text.lua @@ -65,9 +65,9 @@ function Text.screen_line(line, line_cache, i) if i >= #line_cache.screen_line_starting_pos then return line.data:sub(offset) end - local endpos = line_cache.screen_line_starting_pos[i+1]-1 + local endpos = line_cache.screen_line_starting_pos[i+1] local end_offset = Text.offset(line.data, endpos) - return line.data:sub(offset, end_offset) + return line.data:sub(offset, end_offset-1) end function Text.draw_cursor(State, x, y) @@ -147,7 +147,7 @@ function Text.insert_at_cursor(State, t) end -- Don't handle any keys here that would trigger text_input above. -function Text.keychord_press(State, chord) +function Text.keychord_press(State, chord, key, scancode, is_repeat) --? print('chord', chord, State.selection1.line, State.selection1.pos) --== shortcuts that mutate text (must schedule_save) if chord == 'return' then @@ -610,7 +610,7 @@ function Text.pos_at_end_of_screen_line(State, loc1) assert(false, ('invalid pos %d'):format(loc1.pos)) end -function Text.final_text_loc_on_screen(State) +function Text.final_loc_on_screen(State) local screen_bottom1 = Text.screen_bottom1(State) return { line=screen_bottom1.line, @@ -926,7 +926,7 @@ function Text.tweak_screen_top_and_cursor(State) State.cursor1 = deepcopy(State.screen_top1) elseif State.cursor1.line >= screen_bottom1.line then if Text.cursor_out_of_screen(State) then - State.cursor1 = Text.final_text_loc_on_screen(State) + State.cursor1 = Text.final_loc_on_screen(State) end end end |