]> git.mdlowis.com Git - projs/tide.git/commitdiff
made cursor_end work with vertical scrolling
authorMichael D. Lowis <mike@mdlowis.com>
Tue, 5 Jan 2016 03:41:36 +0000 (22:41 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Tue, 5 Jan 2016 03:41:36 +0000 (22:41 -0500)
source/main.c

index 7ab36b6a9189524cc7eb014a1ff9e83c15fcd613..8f86979570a86524b533b4c4471bdac8f1aa8e7f 100644 (file)
@@ -215,16 +215,17 @@ static void cursor_down(void)
 
 static void cursor_up(void)
 {
-    Curr.y--;
-    if (Curr.y < 0) {
-        Curr.y = 0;
-        if (CurrFile.start->prev) {
-            CurrFile.start = CurrFile.start->prev;
-            ScreenDirty = true;
+    if (Loc.line->prev) {
+        Curr.y--;
+        if (Curr.y < 0) {
+            Curr.y = 0;
+            if (CurrFile.start->prev) {
+                CurrFile.start = CurrFile.start->prev;
+                ScreenDirty = true;
+            }
         }
-    }
-    if (Loc.line->prev)
         Loc.line = Loc.line->prev;
+    }
 }
 
 static void cursor_right(void)
@@ -245,11 +246,13 @@ static void cursor_right(void)
 static void cursor_home(void)
 {
     Curr.x = 0;
+    Loc.offset = 0;
     ScreenDirty = true;
 }
 
 static void cursor_end(void)
 {
     Curr.x = ((line_length() <= 1) ? 0 : visible_length());
+    Loc.offset = (line_length() > Max.x) ? line_length()-1 - Max.x : Loc.offset;
     ScreenDirty = true;
 }