From e2b6572e9a1dc7e1c01bfee41b77a26e07c53953 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 20 Mar 2016 11:10:31 +0000 Subject: [PATCH] Not putting cut words into the cutbuffer -- which means: treating the deletion of words like the pressing of Backspace/Delete, so they don't overwrite the lines you cut elsewhere and want to paste into the place of the cut words. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5751 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/text.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index df78076b..d8e2f06d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * src/files.c (do_writeout), src/nano.c (do_exit): Normalize the punctuation in some prompts: no space before a question mark, and a semicolon instead of a comma between phrases. + * src/text.c (do_cutword): Don't put cut words into the cutbuffer -- + that is: treat the deletion of words like pressing Backspace/Delete. 2016-03-19 Benno Schulenberg * src/search.c (search_init): Always remember the last typed string, diff --git a/src/text.c b/src/text.c index b8370256..08c6e81f 100644 --- a/src/text.c +++ b/src/text.c @@ -188,6 +188,12 @@ void do_cutword(bool backward) filestruct *is_current = openfile->current; size_t is_current_x = openfile->current_x; + /* Remember where the cutbuffer is and then make it seem blank. */ + filestruct *is_cutbuffer = cutbuffer; + filestruct *is_cutbottom = cutbottom; + cutbuffer = NULL; + cutbottom = NULL; + /* Move the cursor to a word start, to the left or to the right. */ if (backward) do_prev_word(ISSET(WORD_BOUNDS), FALSE); @@ -205,6 +211,11 @@ void do_cutword(bool backward) /* Now kill the marked region and a word is gone. */ do_cut_text_void(); + + /* Discard the cut word and restore the cutbuffer. */ + free_filestruct(cutbuffer); + cutbuffer = is_cutbuffer; + cutbottom = is_cutbottom; } /* Delete a word leftward. */ -- 2.39.5