2014-07-02 Mark Majeres <mark@engine12.com>
* src/text.c (undo_cut, redo_cut, update_undo): Handle the
- cases of cutting-from-cursor-to-end-of-line properly.
+ cases of cutting-from-cursor-to-end-of-line correctly.
* src/nano.c (do_input): Don't preserve the cutbuffer when
CUT_TO_END is toggled -- it would intermix two cut types.
+ * src/text.c (redo_cut, do_undo, do_redo): Don't forget to
+ free the cutbuffer after use.
2014-07-02 Benno Schulenberg <bensberg@justemail.net>
* src/proto.h: Add a typedef for a pointer to a function.
if (!u->cutbuffer)
return;
+ filestruct *oldcutbuffer = cutbuffer, *oldcutbottom = cutbottom;
+ cutbuffer = NULL;
+ cutbottom = NULL;
+
goto_line_posx(u->lineno, u->begin);
if (ISSET(NO_NEWLINES) && openfile->current->lineno != u->lineno) {
openfile->mark_begin = NULL;
openfile->mark_begin_x = 0;
edit_refresh_needed = TRUE;
+
+ if (cutbuffer != NULL)
+ free_filestruct(cutbuffer);
+ cutbuffer = oldcutbuffer;
+ cutbottom = oldcutbottom;
}
/* Undo the last thing(s) we did. */
openfile->mark_set = TRUE;
goto_line_posx(u->lineno, u->begin);
cut_marked();
+ if (u->cutbuffer != NULL)
+ free_filestruct(u->cutbuffer);
u->cutbuffer = cutbuffer;
u->cutbottom = cutbottom;
cutbuffer = oldcutbuffer;
redidmsg = _("text insert");
goto_line_posx(u->lineno, u->begin);
copy_from_filestruct(u->cutbuffer);
+ free_filestruct(u->cutbuffer);
+ u->cutbuffer = NULL;
break;
default:
redidmsg = _("Internal error: unknown type. Please save your work.");
break;
#endif /* !DISABLE_WRAPPING */
case INSERT:
+ break;
case REPLACE:
data = mallocstrcpy(NULL, fs->current->data);
u->strdata = data;