diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-08-17 09:36:17 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-08-17 09:36:17 -0700 |
commit | f029c710b5f9c8af00d4146af57cbfb8dcda29e8 (patch) | |
tree | 7d7ed386db43eabd24bf4d40091b36c754535f05 /edit.lua | |
parent | 1d710912cc6f4b9649e4cc2c4749c6a852a3ff5a (diff) | |
download | lines.love-f029c710b5f9c8af00d4146af57cbfb8dcda29e8.tar.gz |
simplify cursor-on-screen check
Diffstat (limited to 'edit.lua')
-rw-r--r-- | edit.lua | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/edit.lua b/edit.lua index ccf675b..a0293ab 100644 --- a/edit.lua +++ b/edit.lua @@ -134,7 +134,8 @@ function edit.draw(State) print(State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos) assert(false) end - State.cursor_y = -1 + State.cursor_x = nil + State.cursor_y = nil local y = State.top --? print('== draw') for line_index = State.screen_top1.line,#State.lines do @@ -176,9 +177,6 @@ function edit.draw(State) assert(false) end end - if State.cursor_y == -1 then - State.cursor_y = App.screen.height - end --? print('screen bottom: '..tostring(State.screen_bottom1.pos)..' in '..tostring(State.lines[State.screen_bottom1.line].data)) if State.search_term then Text.draw_search_bar(State) @@ -408,7 +406,7 @@ function edit.keychord_pressed(State, chord, key) Text.insert_at_cursor(State, c) end end - if Text.cursor_past_screen_bottom(State) then + if Text.cursor_out_of_screen(State) then Text.snap_cursor_to_bottom_of_screen(State, State.left, State.right) end schedule_save(State) |