Moving the check for a Delete at the end-of-file to a less frequently
travelled code path. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5284 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
619666460e
commit
8f5fa24e51
|
@ -1,9 +1,11 @@
|
||||||
2015-06-28 Benno Schulenberg <bensberg@justemail.net>
|
2015-07-06 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/global.c (add_to_sclist), src/help.c (help_init), src/nano.h,
|
* src/global.c (add_to_sclist), src/help.c (help_init), src/nano.h,
|
||||||
src/rcfile.c (parse_binding): When defining the toggles, give each
|
src/rcfile.c (parse_binding): When defining the toggles, give each
|
||||||
of them a sequence number, so that, when they are rebound, they can
|
of them a sequence number, so that, when they are rebound, they can
|
||||||
still be listed in the original order in the help text.
|
still be listed in the original order in the help text.
|
||||||
* src/text.c (do_undo): Make it clearer what WAS_FINAL_BACKSPACE does.
|
* src/text.c (do_undo): Make it clearer what WAS_FINAL_BACKSPACE does.
|
||||||
|
* src/text.c (add_undo, do_deletion): Move the check for a Delete at
|
||||||
|
the end-of-file to a less frequently travelled path.
|
||||||
|
|
||||||
GNU nano 2.4.2 - 2015.07.05
|
GNU nano 2.4.2 - 2015.07.05
|
||||||
2015-06-28 Benno Schulenberg <bensberg@justemail.net>
|
2015-06-28 Benno Schulenberg <bensberg@justemail.net>
|
||||||
|
|
10
src/text.c
10
src/text.c
|
@ -120,6 +120,11 @@ void do_deletion(undo_type action)
|
||||||
|
|
||||||
assert(openfile->current_x == strlen(openfile->current->data));
|
assert(openfile->current_x == strlen(openfile->current->data));
|
||||||
|
|
||||||
|
/* When nonewlines isn't set, don't delete the final, magic newline. */
|
||||||
|
if (!ISSET(NO_NEWLINES) && action == DEL && foo == openfile->filebot &&
|
||||||
|
openfile->current_x != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
add_undo(action);
|
add_undo(action);
|
||||||
#endif
|
#endif
|
||||||
|
@ -876,11 +881,6 @@ void add_undo(undo_type action)
|
||||||
((action == ADD && u->type == ADD && u->mark_begin_x == fs->current_x) ||
|
((action == ADD && u->type == ADD && u->mark_begin_x == fs->current_x) ||
|
||||||
(action == CUT && u->type == CUT && !u->mark_set && keeping_cutbuffer())))
|
(action == CUT && u->type == CUT && !u->mark_set && keeping_cutbuffer())))
|
||||||
return;
|
return;
|
||||||
/* When trying to delete the final newline, don't add an undo for it. */
|
|
||||||
if (action == DEL && openfile->current->next == openfile->filebot &&
|
|
||||||
openfile->current->data[openfile->current_x] == '\0' &&
|
|
||||||
openfile->current_x != 0 && !ISSET(NO_NEWLINES))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Blow away the old undo stack if we are starting from the middle. */
|
/* Blow away the old undo stack if we are starting from the middle. */
|
||||||
while (fs->undotop != NULL && fs->undotop != fs->current_undo) {
|
while (fs->undotop != NULL && fs->undotop != fs->current_undo) {
|
||||||
|
|
Loading…
Reference in New Issue