- Add redo of an insert
- Fix bug in fsfromlineno - Tiny cleanups in undo git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4292 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
14c8620e0b
commit
ea577874ef
17
src/text.c
17
src/text.c
|
@ -498,6 +498,7 @@ void do_redo(void)
|
||||||
{
|
{
|
||||||
undo *u = openfile->undotop;
|
undo *u = openfile->undotop;
|
||||||
filestruct *f = openfile->current, *t;
|
filestruct *f = openfile->current, *t;
|
||||||
|
filestruct *oldcutbuffer = cutbuffer, *oldcutbottom = cutbottom;
|
||||||
int len = 0, i;
|
int len = 0, i;
|
||||||
char *undidmsg, *data;
|
char *undidmsg, *data;
|
||||||
|
|
||||||
|
@ -619,6 +620,15 @@ void do_redo(void)
|
||||||
u->strdata = f->data;
|
u->strdata = f->data;
|
||||||
f->data = data;
|
f->data = data;
|
||||||
break;
|
break;
|
||||||
|
case INSERT:
|
||||||
|
undidmsg = _("text insert");
|
||||||
|
cutbuffer = u->cutbuffer;
|
||||||
|
cutbottom = u->cutbottom;
|
||||||
|
do_gotolinecolumn(u->lineno, u->begin+1, FALSE, FALSE, FALSE, FALSE);
|
||||||
|
do_uncut_text();
|
||||||
|
cutbuffer = oldcutbuffer;
|
||||||
|
cutbottom = oldcutbottom;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
undidmsg = _("wtf?");
|
undidmsg = _("wtf?");
|
||||||
break;
|
break;
|
||||||
|
@ -804,11 +814,8 @@ void add_undo(undo_type current_action)
|
||||||
fs->undotop = fs->undotop->next;
|
fs->undotop = fs->undotop->next;
|
||||||
if (u2->strdata != NULL)
|
if (u2->strdata != NULL)
|
||||||
free(u2->strdata);
|
free(u2->strdata);
|
||||||
while (u2->cutbuffer != NULL) {
|
if (u2->cutbuffer);
|
||||||
filestruct *f2 = u2->cutbuffer->next;
|
free_filestruct(u2->cutbuffer);
|
||||||
u2->cutbuffer = u2->cutbuffer->next;
|
|
||||||
free(f2);
|
|
||||||
}
|
|
||||||
free(u2);
|
free(u2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -613,10 +613,10 @@ filestruct *fsfromline(ssize_t lineno)
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
for (; f->lineno != lineno && f->next != NULL; f = f->next)
|
for (; f->lineno != lineno && f->next != NULL; f = f->next)
|
||||||
|
;
|
||||||
|
|
||||||
if (f->lineno != lineno)
|
if (f->lineno != lineno)
|
||||||
return NULL;
|
f = NULL;
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue