about summary refs log tree commit diff stats
path: root/edit.lua
diff options
context:
space:
mode:
Diffstat (limited to 'edit.lua')
-rw-r--r--edit.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/edit.lua b/edit.lua
index 3f7ec34..871e48f 100644
--- a/edit.lua
+++ b/edit.lua
@@ -200,6 +200,20 @@ function edit.mouse_release(State, x,y, mouse_button)
 --?   print('selection:', State.selection1.line, State.selection1.pos)
 end
 
+function edit.mouse_wheel_move(State, dx,dy)
+  if dy > 0 then
+    State.cursor1 = {line=State.screen_top1.line, pos=State.screen_top1.pos}
+    for i=1,math.floor(dy) do
+      Text.up(State)
+    end
+  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)
+    end
+  end
+end
+
 function edit.text_input(State, t)
   if State.search_term then
     State.search_term = State.search_term..t