]> git.mdlowis.com Git - projs/tide.git/commitdiff
fixed home/end key movement
authorMichael D. Lowis <mike.lowis@gentex.com>
Wed, 15 May 2019 00:06:01 +0000 (20:06 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Wed, 15 May 2019 00:06:01 +0000 (20:06 -0400)
src/lib/view.c

index 1add82ff24ee7b836ac6e8dbf1506dc84c798f6d..deb2e8e34ec30b30adb76f58e6cd273edcf92223 100644 (file)
@@ -31,9 +31,11 @@ static void move_selection(View* view, bool extsel, int move, movefn_t bything)
 
 static void move_to(View* view, bool extsel, size_t off) {
     Buf* buf = BUF;
-    CSRPOS = (off > buf_end(buf) ? buf_end(buf) : off);
+    off = (off > buf_end(buf) ? buf_end(buf) : off);
+    int dir = (off < CSRPOS ? LEFT : RIGHT);
+    CSRPOS = off;
     if (!extsel)
-        buf_selclr(BUF, RIGHT);
+        buf_selclr(BUF, dir);
     buf_getcol(buf);
     view->sync_flags |= CURSOR;
 }