From 2859063d9d10f05a3db695cf3ccd142a7432a43f Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 17 Jul 2022 09:19:53 -0700 Subject: switch to line index in a function - Text.to_pos_on_line --- text.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'text.lua') diff --git a/text.lua b/text.lua index 7f7c8f4..50c9c15 100644 --- a/text.lua +++ b/text.lua @@ -703,7 +703,8 @@ function Text.in_line(State, line_index, x,y) end -- convert mx,my in pixels to schema-1 coordinates -function Text.to_pos_on_line(State, line, mx, my) +function Text.to_pos_on_line(State, line_index, mx, my) + local line = State.lines[line_index] if line.fragments == nil then Text.compute_fragments(line, State.left, State.right) end @@ -964,10 +965,9 @@ function Text.tweak_screen_top_and_cursor(State) --? print('too low') if Text.cursor_past_screen_bottom(State) then --? print('tweak') - local line = State.lines[State.screen_bottom1.line] State.cursor1 = { line=State.screen_bottom1.line, - pos=Text.to_pos_on_line(State, line, App.screen.width-5, App.screen.height-5), + pos=Text.to_pos_on_line(State, State.screen_bottom1.line, App.screen.width-5, App.screen.height-5), } end end -- cgit 1.4.1-2-gfad0