From 452066bc88282173c5c7d6f622fdbc3875e5c977 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 2 Nov 2015 13:46:40 +0000 Subject: [PATCH] Chopping the 'undoing' parameter, so that the calls of do_cut_text() become more symmetrical: wrapped in add_undo() + update_undo() where needed. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5390 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 +++- src/cut.c | 19 +++++++++---------- src/proto.h | 2 +- src/text.c | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index b17987da..1ce315ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,9 @@ 2015-11-02 Benno Schulenberg * src/nano.h: Delete an unused type definition. * src/nano.h: Improve several comments. - * src_text.c(do_wrap): Elide two variables. + * src/text.c (do_wrap): Elide two variables. + * src/cut.c (do_cut_text): Chop the 'undoing' parameter, so that the + calls of this function become more symmetrical. 2015-10-31 Benno Schulenberg * src/nano.c (copy_from_filestruct): When pasting while the mark is diff --git a/src/cut.c b/src/cut.c index 7c07cc8c..e26401de 100644 --- a/src/cut.c +++ b/src/cut.c @@ -124,7 +124,7 @@ void cut_to_eof(void) * position to the end of the file into the cutbuffer. */ void do_cut_text( #ifndef NANO_TINY - bool copy_text, bool cut_till_eof, bool undoing + bool copy_text, bool cut_till_eof #else void #endif @@ -214,8 +214,7 @@ void do_cut_text( * disturbing the text. */ if (!old_no_newlines) UNSET(NO_NEWLINES); - } else if (!undoing) - update_undo(cut_till_eof ? CUT_EOF : CUT); + } /* Leave the text in the cutbuffer, and mark the file as * modified. */ @@ -240,12 +239,11 @@ void do_cut_text_void(void) { #ifndef NANO_TINY add_undo(CUT); + do_cut_text(FALSE, FALSE); + update_undo(CUT); +#else + do_cut_text(); #endif - do_cut_text( -#ifndef NANO_TINY - FALSE, FALSE, FALSE -#endif - ); } #ifndef NANO_TINY @@ -260,7 +258,7 @@ void do_copy_text(void) if (mark_set || openfile->current != next_contiguous_line) cutbuffer_reset(); - do_cut_text(TRUE, FALSE, FALSE); + do_cut_text(TRUE, FALSE); /* If the mark was set, blow away the cutbuffer on the next copy. */ next_contiguous_line = (mark_set ? NULL : openfile->current); @@ -270,7 +268,8 @@ void do_copy_text(void) void do_cut_till_eof(void) { add_undo(CUT_EOF); - do_cut_text(FALSE, TRUE, FALSE); + do_cut_text(FALSE, TRUE); + update_undo(CUT_EOF); } #endif /* !NANO_TINY */ diff --git a/src/proto.h b/src/proto.h index 7a18595f..09fe8726 100644 --- a/src/proto.h +++ b/src/proto.h @@ -260,7 +260,7 @@ void cut_to_eof(void); #endif void do_cut_text( #ifndef NANO_TINY - bool copy_text, bool cut_till_eof, bool undoing + bool copy_text, bool cut_till_eof #else void #endif diff --git a/src/text.c b/src/text.c index 4d1a3266..dec98164 100644 --- a/src/text.c +++ b/src/text.c @@ -461,7 +461,7 @@ void redo_cut(undo *u) openfile->mark_begin = fsfromline(u->mark_begin_lineno); openfile->mark_begin_x = (u->xflags == WAS_WHOLE_LINE) ? 0 : u->mark_begin_x; - do_cut_text(FALSE, FALSE, TRUE); + do_cut_text(FALSE, FALSE); openfile->mark_set = FALSE; openfile->mark_begin = NULL; -- 2.39.5