nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] [PATCH] text: create an undo item for ENTER before changing


From: Benno Schulenberg
Subject: [Nano-devel] [PATCH] text: create an undo item for ENTER before changing the file size
Date: Sun, 22 Jul 2018 09:20:40 +0200

The undo item should record the file size before anything is added
by the ENTER action -- in this case: auto-indentation whitespace.

This fixes https://savannah.gnu.org/bugs/?54344.
Reported-by: Liu Hao <address@hidden>
---
 src/text.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/text.c b/src/text.c
index f9bfa7e2..0f97514b 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1022,6 +1022,8 @@ void do_enter(void)
        filestruct *sampleline = openfile->current;
        bool allblanks = FALSE;
 
+       add_undo(ENTER);
+
        if (ISSET(AUTOINDENT)) {
 #ifdef ENABLE_JUSTIFY
                /* When doing automatic long-line wrapping and the next line is
@@ -1058,8 +1060,6 @@ void do_enter(void)
        null_at(&openfile->current->data, openfile->current_x);
 
 #ifndef NANO_TINY
-       add_undo(ENTER);
-
        /* Adjust the mark if it was on the current line after the cursor. */
        if (openfile->mark == openfile->current &&
                                openfile->mark_x > openfile->current_x) {
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]