From 7ada64dc6aa49694e8004d287863782395e67ba8 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 14 May 2019 20:06:01 -0400 Subject: [PATCH] fixed home/end key movement --- src/lib/view.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/view.c b/src/lib/view.c index 1add82f..deb2e8e 100644 --- a/src/lib/view.c +++ b/src/lib/view.c @@ -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; } -- 2.52.0