]> git.mdlowis.com Git - projs/tide.git/commitdiff
remember cursor's desired column
authora bellenir <a@bellenir.com>
Mon, 4 Jan 2016 21:14:26 +0000 (16:14 -0500)
committera bellenir <a@bellenir.com>
Mon, 4 Jan 2016 21:14:26 +0000 (16:14 -0500)
source/main.c

index b5e73694ff244fc58e5779a73c2b6ab55bbcb0d5..ba4951b3e67cfed8b48341bea58ac26da2f3f8fd 100644 (file)
@@ -134,7 +134,13 @@ static void edit(void)
             ScreenDirty = false;
         }
         /* Place the cursor */
-        move(Curr.y, Curr.x);
+        /* Cap the column selection at the end of text on the current line */
+        int x = Curr.x;
+        if (Loc.line->length <= 1)
+            x = 0;
+        else if (x >= (Loc.line->length-1 - Loc.offset))
+            x = (Loc.line->length-2 - Loc.offset);
+        move(Curr.y, x);
     } while((ch = getch()) != 'q');
 }
 
@@ -171,11 +177,6 @@ static void input(int ch)
             cursorEnd();
             break;
     }
-    /* Cap the column selection at the end of text on the current line */
-    if (Loc.line->length <= 1)
-        Curr.x = 0;
-    else if (Curr.x >= (Loc.line->length-1 - Loc.offset))
-        Curr.x = (Loc.line->length-2 - Loc.offset);
 }
 
 static void cursorLeft()