]> git.mdlowis.com Git - projs/tide.git/commitdiff
Append should append the text after the last line of the buffer if selection is null...
authorMichael D. Lowis <mike.lowis@gentex.com>
Mon, 28 Nov 2016 14:41:31 +0000 (09:41 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Mon, 28 Nov 2016 14:41:31 +0000 (09:41 -0500)
libedit/view.c

index 198d533ab1d47222ab317620c9cf9fab11cc911e..525fd5fc6cc7b9cec1bae3242b63ef75f567409b 100644 (file)
@@ -429,6 +429,10 @@ void view_append(View* view, char* str) {
     size_t end = buf_end(&(view->buffer));
     if (view->selection.end != end)
         view->selection = (Sel){ .beg = end, .end = end };
+       if (!num_selected(view->selection) && !buf_iseol(&(view->buffer), view->selection.end-1)) {
+        buf_ins(&(view->buffer), view->selection.end++, '\n');
+        view->selection.beg++;
+    }
     view_putstr(view, str);
     view_selprev(view);
 }