From: Michael D. Lowis Date: Wed, 15 May 2019 00:06:01 +0000 (-0400) Subject: fixed home/end key movement X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=7ada64dc6aa49694e8004d287863782395e67ba8;p=projs%2Ftide.git fixed home/end key movement --- 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; }