]> git.mdlowis.com Git - projs/tide.git/commitdiff
refactored logic for setting cursor to specific offset
authorMichael D. Lowis <mike.lowis@gentex.com>
Mon, 21 Oct 2019 20:20:56 +0000 (16:20 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Mon, 21 Oct 2019 20:20:56 +0000 (16:20 -0400)
src/lib/view.c

index de2e64649e862d9e282c778d87b4914144c38256..fbe360d2c1499d864d6dfb0f1135acdde1fd953a 100644 (file)
@@ -317,12 +317,7 @@ static size_t getoffset(View* view, size_t row, size_t col)
 
 void view_setcursor(View* view, size_t row, size_t col, bool extsel)
 {
-    getsel(view)->end = getoffset(view, row, col);
-    if (!extsel)
-    {
-        getsel(view)->beg = getsel(view)->end;
-    }
-    buf_getcol(BUF);
+    buf_selmoveto(BUF, extsel, getoffset(view, row, col));
     ensure(view_valid(view));
 }