From: Michael D. Lowis Date: Fri, 30 Jun 2017 16:02:24 +0000 (-0400) Subject: Added logic to delete previous newline if cutting the last line of a buffer X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=d26321aa9fa3b743b19d80b881e643f66b434c02;p=projs%2Ftide.git Added logic to delete previous newline if cutting the last line of a buffer --- diff --git a/inc/shortcuts.h b/inc/shortcuts.h index fe4c903..39767c2 100644 --- a/inc/shortcuts.h +++ b/inc/shortcuts.h @@ -31,13 +31,18 @@ static void onpaste(char* text) { } static void cut(void) { + View* view = win_view(FOCUSED); /* select the current line if no selection */ - if (!view_selsize(win_view(FOCUSED))) + if (!view_selsize(view)) select_line(); /* now perform the cut */ - char* str = view_getstr(win_view(FOCUSED), NULL); + char* str = view_getstr(view, NULL); x11_sel_set(CLIPBOARD, str); - if (str && *str) delete(); + if (str && *str) { + delete(); + if (view->selection.end == buf_end(&(view->buffer))) + view_delete(view, LEFT, false); + } } static void paste(void) {