diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-07-17 09:19:53 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-07-17 09:19:53 -0700 |
commit | 2859063d9d10f05a3db695cf3ccd142a7432a43f (patch) | |
tree | 3c8c2f33d72965909d2cce1a258dbbde0f929bd8 /text.lua | |
parent | 6b3ddc816ff6784ed36d6254d35c8d12ada28246 (diff) | |
download | lines.love-2859063d9d10f05a3db695cf3ccd142a7432a43f.tar.gz |
switch to line index in a function
- Text.to_pos_on_line
Diffstat (limited to 'text.lua')
-rw-r--r-- | text.lua | 6 |
1 files changed, 3 insertions, 3 deletions
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 |