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-d3aeb78583b8master
parent
d0e8887e3b
commit
452066bc88
|
@ -1,7 +1,9 @@
|
||||||
2015-11-02 Benno Schulenberg <bensberg@justemail.net>
|
2015-11-02 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/nano.h: Delete an unused type definition.
|
* src/nano.h: Delete an unused type definition.
|
||||||
* src/nano.h: Improve several comments.
|
* 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>
|
2015-10-31 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/nano.c (copy_from_filestruct): When pasting while the mark is
|
* src/nano.c (copy_from_filestruct): When pasting while the mark is
|
||||||
|
|
19
src/cut.c
19
src/cut.c
|
@ -124,7 +124,7 @@ void cut_to_eof(void)
|
||||||
* position to the end of the file into the cutbuffer. */
|
* position to the end of the file into the cutbuffer. */
|
||||||
void do_cut_text(
|
void do_cut_text(
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
bool copy_text, bool cut_till_eof, bool undoing
|
bool copy_text, bool cut_till_eof
|
||||||
#else
|
#else
|
||||||
void
|
void
|
||||||
#endif
|
#endif
|
||||||
|
@ -214,8 +214,7 @@ void do_cut_text(
|
||||||
* disturbing the text. */
|
* disturbing the text. */
|
||||||
if (!old_no_newlines)
|
if (!old_no_newlines)
|
||||||
UNSET(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
|
/* Leave the text in the cutbuffer, and mark the file as
|
||||||
* modified. */
|
* modified. */
|
||||||
|
@ -240,12 +239,11 @@ void do_cut_text_void(void)
|
||||||
{
|
{
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
add_undo(CUT);
|
add_undo(CUT);
|
||||||
|
do_cut_text(FALSE, FALSE);
|
||||||
|
update_undo(CUT);
|
||||||
|
#else
|
||||||
|
do_cut_text();
|
||||||
#endif
|
#endif
|
||||||
do_cut_text(
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
FALSE, FALSE, FALSE
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
@ -260,7 +258,7 @@ void do_copy_text(void)
|
||||||
if (mark_set || openfile->current != next_contiguous_line)
|
if (mark_set || openfile->current != next_contiguous_line)
|
||||||
cutbuffer_reset();
|
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. */
|
/* If the mark was set, blow away the cutbuffer on the next copy. */
|
||||||
next_contiguous_line = (mark_set ? NULL : openfile->current);
|
next_contiguous_line = (mark_set ? NULL : openfile->current);
|
||||||
|
@ -270,7 +268,8 @@ void do_copy_text(void)
|
||||||
void do_cut_till_eof(void)
|
void do_cut_till_eof(void)
|
||||||
{
|
{
|
||||||
add_undo(CUT_EOF);
|
add_undo(CUT_EOF);
|
||||||
do_cut_text(FALSE, TRUE, FALSE);
|
do_cut_text(FALSE, TRUE);
|
||||||
|
update_undo(CUT_EOF);
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ void cut_to_eof(void);
|
||||||
#endif
|
#endif
|
||||||
void do_cut_text(
|
void do_cut_text(
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
bool copy_text, bool cut_till_eof, bool undoing
|
bool copy_text, bool cut_till_eof
|
||||||
#else
|
#else
|
||||||
void
|
void
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -461,7 +461,7 @@ void redo_cut(undo *u)
|
||||||
openfile->mark_begin = fsfromline(u->mark_begin_lineno);
|
openfile->mark_begin = fsfromline(u->mark_begin_lineno);
|
||||||
openfile->mark_begin_x = (u->xflags == WAS_WHOLE_LINE) ? 0 : u->mark_begin_x;
|
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_set = FALSE;
|
||||||
openfile->mark_begin = NULL;
|
openfile->mark_begin = NULL;
|
||||||
|
|
Loading…
Reference in New Issue