diff --git a/ChangeLog b/ChangeLog index b17987da30d3e00c880a3e32c6a5c53981c3e78b..1ce315ec74a1bf1bc780a6d8896f0cefd27472e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,9 @@ 2015-11-02 Benno Schulenberg <bensberg@justemail.net> * 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 <bensberg@justemail.net> * src/nano.c (copy_from_filestruct): When pasting while the mark is diff --git a/src/cut.c b/src/cut.c index 7c07cc8ca151433552651ac11cb0d7c45dfbc1ea..e26401de6a3832b2db2fa0c13db98bf45136a90f 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 7a18595f5a8b06da792b2c7f461ece1630eaa6b8..09fe8726d4d65ddb055451a6c960a254441be34b 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 4d1a326677f1589aab045cdc02de39f21012f3fc..dec98164b690bba24dd3706e8a797491955aa1a8 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;