]> git.mdlowis.com Git - projs/tide.git/commitdiff
slowed down scrolling. would be nice to have dynamic scrolling speed
authorMichael D. Lowis <mike.lowis@gentex.com>
Fri, 20 Apr 2018 18:35:42 +0000 (14:35 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Fri, 20 Apr 2018 18:35:42 +0000 (14:35 -0400)
lib/config.c
lib/view.c
lib/x11.c

index ce4f634098f4bd5e5f3d1686ad6c7766fe650a0c..1681afa8730e06ab2f8474371651da44b978b679 100644 (file)
@@ -22,7 +22,7 @@ int /* Integer config options */
     LineSpacing = LNSPACE,
     Timeout = 50,
     TabWidth = 4,
-    ScrollBy = 2,
+    ScrollBy = 1,
     ClickTime = 500,
     MaxScanDist = 0,
     Syntax = ON,
index 54e2c9ea37b03a771ff1cea1af398f89f013a7c0..7b3d464a10c76f8147a547503767f2fd06d96bb2 100644 (file)
@@ -45,18 +45,6 @@ static bool selection_visible(View* view) {
     return (beg <= csr && csr <= end);
 }
 
-static void find_cursor(View* view, size_t* csrx, size_t* csry) {
-    size_t csr = CSRPOS;
-    for (size_t y = 0; y < view->nrows; y++) {
-        size_t start = view->rows[y]->off;
-        size_t end   = view->rows[y]->off + view->rows[y]->len - 1;
-        if (start <= csr && csr <= end) {
-            size_t pos = start;
-            break;
-        }
-    }
-}
-
 static Sel* getsel(View* view) {
     return &(view->buffer.selection);
 }
index 535dcdfca215401450df6c96a1782094999a886a..90d913f2066da692e37d9e883c224bfb875cef43 100644 (file)
--- a/lib/x11.c
+++ b/lib/x11.c
@@ -238,6 +238,11 @@ static void mouse_right(WinRegion id, bool pressed, size_t row, size_t col) {
     }
 }
 
+static void mouse_scroll(WinRegion id, bool pressed, int amount) {
+    if (!pressed)
+        view_scroll(win_view(id), amount);
+}
+
 static void mouse_click(int btn, bool pressed, int x, int y) {
     size_t row, col;
     Focused = (y <= Divider ? TAGS : EDIT);
@@ -246,8 +251,8 @@ static void mouse_click(int btn, bool pressed, int x, int y) {
         case MouseLeft:    mouse_left(Focused, pressed, row, col);    break;
         case MouseMiddle:  mouse_middle(Focused, pressed, row, col);  break;
         case MouseRight:   mouse_right(Focused, pressed, row, col);   break;
-        case MouseWheelUp: view_scroll(win_view(Focused), -ScrollBy); break;
-        case MouseWheelDn: view_scroll(win_view(Focused), +ScrollBy); break;
+        case MouseWheelUp: mouse_scroll(Focused, pressed, -ScrollBy); break;
+        case MouseWheelDn: mouse_scroll(Focused, pressed, +ScrollBy); break;
     }
 }