-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/rcfile.c (parse_binding): When defining the toggles, give each
of them a sequence number, so that, when they are rebound, they can
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 (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
2015-06-28 Benno Schulenberg <bensberg@justemail.net>
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
add_undo(action);
#endif
((action == ADD && u->type == ADD && u->mark_begin_x == fs->current_x) ||
(action == CUT && u->type == CUT && !u->mark_set && keeping_cutbuffer())))
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. */
while (fs->undotop != NULL && fs->undotop != fs->current_undo) {