]> git.mdlowis.com Git - projs/tide.git/commitdiff
don't move cursor past last line of file
authora bellenir <a@bellenir.com>
Mon, 4 Jan 2016 21:22:36 +0000 (16:22 -0500)
committera bellenir <a@bellenir.com>
Mon, 4 Jan 2016 21:22:36 +0000 (16:22 -0500)
source/main.c

index ba4951b3e67cfed8b48341bea58ac26da2f3f8fd..9f1ca3a21c05bda19261b1bbe011111fa6938d44 100644 (file)
@@ -193,16 +193,17 @@ static void cursorLeft()
 
 static void cursorDown()
 {
-    Curr.y++;
-    if (Curr.y >= Max.y) {
-        Curr.y = Max.y-1;
-        if (Curr_File.start->next) {
-            Curr_File.start = Curr_File.start->next;
-            ScreenDirty = true;
-        }
-    }
-    if (Loc.line->next)
+       if (Loc.line->next) {
+               Curr.y++;
+               if (Curr.y >= Max.y) {
+                       Curr.y = Max.y-1;
+                       if (Curr_File.start->next) {
+                               Curr_File.start = Curr_File.start->next;
+                               ScreenDirty = true;
+                       }
+               }
         Loc.line = Loc.line->next;
+    }
 }
 
 static void cursorUp()