2009-07-27 Chris Allegretta <chrisa@asty.org>

* text.c (undo_cut, redo_cut): Don't actually try and undo/redo an empty cut, i.e. the magicline. 
	  Fixes crash on cutting last line discovered by Eitan Adler <eitanadlerlist@gmail.com>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4397 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2009-07-27 04:16:44 +00:00
parent 0a10e20eec
commit 42726f74cc
2 changed files with 53 additions and 41 deletions

View File

@ -1,3 +1,7 @@
2009-07-27 Chris Allegretta <chrisa@asty.org>
* text.c (undo_cut, redo_cut): Don't actually try and undo/redo an empty cut, i.e. the magicline.
Fixes crash on cutting last line discovered by Eitan Adler <eitanadlerlist@gmail.com>.
2009-07-11 Chris Allegretta <chrisa@asty.org>
* nano-regress: Small tweaks
* Change undo code to off unless unabled via a command line option (-u/--undo). Until this code

View File

@ -360,6 +360,10 @@ void do_unindent(void)
/* undo a cut, or re-do an uncut */
void undo_cut(undo *u)
{
/* If we cut the magicline may was well not crash :/ */
if (!u->cutbuffer)
return;
cutbuffer = copy_filestruct(u->cutbuffer);
/* Compute cutbottom for the uncut using out copy */
@ -383,6 +387,10 @@ void redo_cut(undo *u) {
int i;
filestruct *t, *c;
/* If we cut the magicline may was well not crash :/ */
if (!u->cutbuffer)
return;
do_gotolinecolumn(u->lineno, u->begin+1, FALSE, FALSE, FALSE, FALSE);
openfile->mark_set = u->mark_set;
if (cutbuffer)