]> git.mdlowis.com Git - projs/tide.git/commitdiff
selecting last line should not select past end of buffer on line-select
authorMichael D. Lowis <mike@mdlowis.com>
Sun, 26 Mar 2017 00:22:35 +0000 (20:22 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Sun, 26 Mar 2017 00:22:35 +0000 (20:22 -0400)
lib/view.c

index 401ddb938b3c6040b508521074750fa66f6c8f72..b5d840b844463c0ebc243390e933aa556340b21f 100644 (file)
@@ -342,7 +342,8 @@ void view_select(View* view, size_t row, size_t col) {
     view_setcursor(view, row, col);
     Sel sel = view->selection;
     selcontext(view, &sel);
-    sel.end++;
+    if (sel.end+1 < buf_end(&(view->buffer)))
+        sel.end++;
     view->selection = sel;
 }