mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-30 22:24:41 +03:00
undo: remove the added magic line when a replacement caused one
This fixes https://savannah.gnu.org/bugs/?59796. Bug existed since before version 2.2.4.
This commit is contained in:
parent
45efe28f05
commit
0f4bb64eaf
@ -583,6 +583,8 @@ void do_undo(void)
|
||||
break;
|
||||
case REPLACE:
|
||||
undidmsg = _("replacement");
|
||||
if ((u->xflags & INCLUDED_LAST_LINE) && !ISSET(NO_NEWLINES))
|
||||
remove_magicline();
|
||||
data = u->strdata;
|
||||
u->strdata = line->data;
|
||||
line->data = data;
|
||||
@ -755,6 +757,8 @@ void do_redo(void)
|
||||
break;
|
||||
case REPLACE:
|
||||
redidmsg = _("replacement");
|
||||
if ((u->xflags & INCLUDED_LAST_LINE) && !ISSET(NO_NEWLINES))
|
||||
new_magicline();
|
||||
data = u->strdata;
|
||||
u->strdata = line->data;
|
||||
line->data = data;
|
||||
@ -1039,6 +1043,8 @@ void add_undo(undo_type action, const char *message)
|
||||
break;
|
||||
case REPLACE:
|
||||
u->strdata = copy_of(thisline->data);
|
||||
if (thisline == openfile->filebot && u->strdata[0] != '\0')
|
||||
u->xflags |= INCLUDED_LAST_LINE;
|
||||
break;
|
||||
#ifdef ENABLE_WRAPPING
|
||||
case SPLIT_BEGIN:
|
||||
|
Loading…
Reference in New Issue
Block a user