* 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.
+ * src/text.c (do_deletion): If a Backspace happens at the end-of-file,
+ don't remove and then re-add the magic line; just add an undo item.
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)
+ if (!ISSET(NO_NEWLINES) && foo == openfile->filebot &&
+ openfile->current_x != 0) {
+#ifndef NANO_TINY
+ if (action == BACK)
+ add_undo(BACK);
+#endif
return;
+ }
#ifndef NANO_TINY
add_undo(action);
/* Two lines were joined, so we need to refresh the screen. */
edit_refresh_needed = TRUE;
-
- /* If the NO_NEWLINES flag isn't set, and text has been added to
- * the magicline as a result of deleting at the end of the line
- * before filebot, add a new magicline. */
- if (!ISSET(NO_NEWLINES) && openfile->current == openfile->filebot &&
- openfile->current->data[0] != '\0')
- new_magicline();
} else
return;