commit 452066bc88282173c5c7d6f622fdbc3875e5c977
parent d0e8887e3b24bf5daea74ddc51142671216b3f94
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Mon, 2 Nov 2015 13:46:40 +0000
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
Diffstat:
4 files changed, 14 insertions(+), 13 deletions(-)
diff --git 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
@@ -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
@@ -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
@@ -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;