diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2025-01-22 15:12:06 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2025-01-22 15:35:10 -0800 |
commit | c17ea5543942217a930864e277764f2e2e8d64c0 (patch) | |
tree | e26aa5032f759c9fa8a44e9a9d415b8106ee0132 | |
parent | 117c56a9bc2c73e1242732686e3e7d3d554ba3df (diff) | |
download | view.love-c17ea5543942217a930864e277764f2e2e8d64c0.tar.gz |
bugfix: scrolling up using scroll wheel
The culprit is an ambiguously named helper. put_cursor_on_next_text_line is not supposed to move to next line if the current line is text.
-rw-r--r-- | edit.lua | 12 | ||||
-rw-r--r-- | source_edit.lua | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/edit.lua b/edit.lua index 03565f8..269d6ef 100644 --- a/edit.lua +++ b/edit.lua @@ -141,13 +141,13 @@ end function edit.put_cursor_on_next_text_line(State) local line = State.cursor1.line - while line < #State.lines do + if State.lines[line].mode == 'text' then return end + while line <= #State.lines and State.lines[line].mode ~= 'text' do line = line+1 - if State.lines[line].mode == 'text' then - State.cursor1.line = line - State.cursor1.pos = 1 - break - end + end + if line <= #State.lines and State.lines[line].mode == 'text' then + State.cursor1.line = line + State.cursor1.pos = 1 end end diff --git a/source_edit.lua b/source_edit.lua index a8dd682..91bcb58 100644 --- a/source_edit.lua +++ b/source_edit.lua @@ -143,13 +143,13 @@ end function edit.put_cursor_on_next_text_line(State) local line = State.cursor1.line - while line < #State.lines do + if State.lines[line].mode == 'text' then return end + while line <= #State.lines and State.lines[line].mode ~= 'text' do line = line+1 - if State.lines[line].mode == 'text' then - State.cursor1.line = line - State.cursor1.pos = 1 - break - end + end + if line <= #State.lines and State.lines[line].mode == 'text' then + State.cursor1.line = line + State.cursor1.pos = 1 end end |