From a6dcfc5ac862637719b35c0fda137fdb4015c540 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 23 Mar 2023 21:38:33 -0700 Subject: some minor cleanup I can't see the mouse wheel ever setting dx, but it's more obvious now that the editor doesn't support panning left/right. --- edit.lua | 2 +- log_browser.lua | 2 +- run.lua | 4 ++-- source_edit.lua | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/edit.lua b/edit.lua index 3f87551..b894dde 100644 --- a/edit.lua +++ b/edit.lua @@ -310,7 +310,7 @@ function edit.mouse_wheel_move(State, dx,dy) for i=1,math.floor(dy) do Text.up(State) end - else + elseif dy < 0 then State.cursor1 = {line=State.screen_bottom1.line, pos=State.screen_bottom1.pos} for i=1,math.floor(-dy) do Text.down(State) diff --git a/log_browser.lua b/log_browser.lua index cd0d8fc..46d84c0 100644 --- a/log_browser.lua +++ b/log_browser.lua @@ -268,7 +268,7 @@ function log_browser.mouse_wheel_move(State, dx,dy) for i=1,math.floor(dy) do log_browser.up(State) end - else + elseif dy < 0 then for i=1,math.floor(-dy) do log_browser.down(State) end diff --git a/run.lua b/run.lua index ae78d9b..17477ea 100644 --- a/run.lua +++ b/run.lua @@ -163,9 +163,9 @@ function run.mouse_release(x,y, mouse_button) return edit.mouse_release(Editor_state, x,y, mouse_button) end -function run.mouse_wheel_move(x,y) +function run.mouse_wheel_move(dx,dy) Cursor_time = 0 -- ensure cursor is visible immediately after it moves - return edit.mouse_wheel_move(Editor_state, x,y) + return edit.mouse_wheel_move(Editor_state, dx,dy) end function run.text_input(t) diff --git a/source_edit.lua b/source_edit.lua index 60ed027..b70aab1 100644 --- a/source_edit.lua +++ b/source_edit.lua @@ -311,7 +311,7 @@ function edit.mouse_wheel_move(State, dx,dy) for i=1,math.floor(dy) do Text.up(State) end - else + elseif dy < 0 then State.cursor1 = {line=State.screen_bottom1.line, pos=State.screen_bottom1.pos} for i=1,math.floor(-dy) do Text.down(State) -- cgit 1.4.1-2-gfad0