From d26321aa9fa3b743b19d80b881e643f66b434c02 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 30 Jun 2017 12:02:24 -0400 Subject: [PATCH] Added logic to delete previous newline if cutting the last line of a buffer --- inc/shortcuts.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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) { -- 2.49.0