From: Michael D. Lowis Date: Mon, 28 Nov 2016 14:41:31 +0000 (-0500) Subject: Append should append the text after the last line of the buffer if selection is null... X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=921f8f222f00f0e3ba44a20f57b31710273a065e;p=projs%2Ftide.git Append should append the text after the last line of the buffer if selection is null, inserting a newline if necessary --- diff --git a/libedit/view.c b/libedit/view.c index 198d533..525fd5f 100644 --- a/libedit/view.c +++ b/libedit/view.c @@ -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); }