From ff36b05cdbfea17fb0734651ebc9ce1ad3076209 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 29 May 2014 18:50:13 +0000 Subject: [PATCH] Differentiating (for the undo structure) between deleting a newline and any other character. Patch by Mark Majeres. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4934 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/text.c | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ba81a39..f1a38847 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-05-29 Mark Majeres + * src/text.c (do_delete): For the undo structure, differentiate + between deleting a newline and any other character. + 2014-05-29 Chris Allegretta * src/chars.c (addstrings): Needs to be available even on non-utf-8 sustems. diff --git a/src/text.c b/src/text.c index 8e32f00e..29d9fb07 100644 --- a/src/text.c +++ b/src/text.c @@ -68,10 +68,6 @@ void do_delete(void) { size_t orig_lenpt = 0; -#ifndef NANO_TINY - update_undo(DEL); -#endif - assert(openfile->current != NULL && openfile->current->data != NULL && openfile->current_x <= strlen(openfile->current->data)); openfile->placewewant = xplustabs(); @@ -84,6 +80,9 @@ void do_delete(void) assert(openfile->current_x < strlen(openfile->current->data)); +#ifndef NANO_TINY + update_undo(DEL); +#endif if (ISSET(SOFTWRAP)) orig_lenpt = strlenpt(openfile->current->data); @@ -106,6 +105,9 @@ void do_delete(void) assert(openfile->current_x == strlen(openfile->current->data)); +#ifndef NANO_TINY + add_undo(DEL); +#endif /* If we're deleting at the end of a line, we need to call * edit_refresh(). */ if (openfile->current->data[openfile->current_x] == '\0') -- 2.39.5