Skipping the undo of a backspace *only* when it really
tried to delete the final, magic newline. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5267 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
75ac24b25e
commit
412b9fc0a2
|
@ -1,3 +1,7 @@
|
||||||
|
2015-06-27 Benno Schulenberg <bensberg@justemail.net>
|
||||||
|
* src/text.c (do_undo, add_undo): Skip undoing a backspace *only* when
|
||||||
|
it really tried to delete the final, magic newline.
|
||||||
|
|
||||||
2015-06-23 Benno Schulenberg <bensberg@justemail.net>
|
2015-06-23 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/winio.c (edit_draw): Verify that there exists multidata for the
|
* src/winio.c (edit_draw): Verify that there exists multidata for the
|
||||||
found starting line before trying to use it. When a file is inserted
|
found starting line before trying to use it. When a file is inserted
|
||||||
|
|
|
@ -570,7 +570,7 @@ enum
|
||||||
#define KEY_WINCH -2
|
#define KEY_WINCH -2
|
||||||
|
|
||||||
/* Some extra bits for the undo function. */
|
/* Some extra bits for the undo function. */
|
||||||
#define UNdel_backspace (1<<1)
|
#define SKIP_FINAL_BACKSPACE (1<<1)
|
||||||
#define UNcut_marked_forward (1<<2)
|
#define UNcut_marked_forward (1<<2)
|
||||||
#define UNcut_cutline (1<<3)
|
#define UNcut_cutline (1<<3)
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
|
@ -503,8 +503,7 @@ void do_undo(void)
|
||||||
undidmsg = _("line join");
|
undidmsg = _("line join");
|
||||||
/* When the join was done by a Backspace at the tail of the file,
|
/* When the join was done by a Backspace at the tail of the file,
|
||||||
* don't actually add another line; just position the cursor. */
|
* don't actually add another line; just position the cursor. */
|
||||||
if (f->next != openfile->filebot || ISSET(NO_NEWLINES) ||
|
if (ISSET(NO_NEWLINES) || u->xflags != SKIP_FINAL_BACKSPACE) {
|
||||||
u->xflags != UNdel_backspace) {
|
|
||||||
t = make_new_node(f);
|
t = make_new_node(f);
|
||||||
t->data = mallocstrcpy(NULL, u->strdata);
|
t->data = mallocstrcpy(NULL, u->strdata);
|
||||||
data = mallocstrncpy(NULL, f->data, u->mark_begin_x + 1);
|
data = mallocstrncpy(NULL, f->data, u->mark_begin_x + 1);
|
||||||
|
@ -936,7 +935,10 @@ void add_undo(undo_type action)
|
||||||
case ADD:
|
case ADD:
|
||||||
break;
|
break;
|
||||||
case BACK:
|
case BACK:
|
||||||
u->xflags = UNdel_backspace;
|
/* If the next line is the magic line, don't ever undo this
|
||||||
|
* backspace, as it won't actually have deleted anything. */
|
||||||
|
if (fs->current->next == fs->filebot && fs->current->data[0] != '\0')
|
||||||
|
u->xflags = SKIP_FINAL_BACKSPACE;
|
||||||
case DEL:
|
case DEL:
|
||||||
if (u->begin != strlen(fs->current->data)) {
|
if (u->begin != strlen(fs->current->data)) {
|
||||||
char *char_buf = charalloc(mb_cur_max() + 1);
|
char *char_buf = charalloc(mb_cur_max() + 1);
|
||||||
|
|
Loading…
Reference in New Issue