2008-10-13 Chris Allegretta <chrisa@asty.org>
* Remove CUTTOEND as an undo type as it's unneeded, fix u->to_end logic in undo struct. * undo.c (update_undo): Don't free cutbuffer if NULL, fix for Savannah bug #24499 git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4339 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
5c1c143ed2
Коммит
c84e765b8e
@ -1,3 +1,7 @@
|
|||||||
|
2008-10-13 Chris Allegretta <chrisa@asty.org>
|
||||||
|
* Remove CUTTOEND as an undo type as it's unneeded, fix u->to_end logic in undo struct.
|
||||||
|
* undo.c (update_undo): Don't free cutbuffer if NULL, fix for Savannah bug #24499
|
||||||
|
|
||||||
2008-10-04 Chris Allegretta <chrisa@asty.org>
|
2008-10-04 Chris Allegretta <chrisa@asty.org>
|
||||||
* cut.c (Add_undo): Save last cut undo information so it can be used for next uncut, fixes
|
* cut.c (Add_undo): Save last cut undo information so it can be used for next uncut, fixes
|
||||||
Savannah bug 24183.
|
Savannah bug 24183.
|
||||||
|
@ -245,7 +245,7 @@ void do_copy_text(void)
|
|||||||
void do_cut_till_end(void)
|
void do_cut_till_end(void)
|
||||||
{
|
{
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
add_undo(CUTTOEND);
|
add_undo(CUT);
|
||||||
#endif
|
#endif
|
||||||
do_cut_text(FALSE, TRUE, FALSE);
|
do_cut_text(FALSE, TRUE, FALSE);
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ typedef enum {
|
|||||||
} function_type;
|
} function_type;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, CUTTOEND, UNCUT, INSERT, OTHER
|
ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, UNCUT, INSERT, OTHER
|
||||||
} undo_type;
|
} undo_type;
|
||||||
|
|
||||||
/* Structure types. */
|
/* Structure types. */
|
||||||
|
12
src/text.c
12
src/text.c
@ -408,7 +408,7 @@ void redo_cut(undo *u) {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Undoing multi-^K cut, u->linescut = %d\n", u->linescut);
|
fprintf(stderr, "Undoing multi-^K cut, u->linescut = %d\n", u->linescut);
|
||||||
#endif
|
#endif
|
||||||
for (i = 0, t = openfile->current; i < u->linescut; i++) {
|
for (i = 0, t = openfile->current; i < u->linescut && t->next != NULL ; i++) {
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Advancing, lineno = %d, data = \"%s\"\n", t->lineno, t->data);
|
fprintf(stderr, "Advancing, lineno = %d, data = \"%s\"\n", t->lineno, t->data);
|
||||||
@ -505,7 +505,6 @@ void do_undo(void)
|
|||||||
renumber(f);
|
renumber(f);
|
||||||
break;
|
break;
|
||||||
case CUT:
|
case CUT:
|
||||||
case CUTTOEND:
|
|
||||||
undidmsg = _("text cut");
|
undidmsg = _("text cut");
|
||||||
undo_cut(u);
|
undo_cut(u);
|
||||||
break;
|
break;
|
||||||
@ -629,7 +628,6 @@ void do_redo(void)
|
|||||||
renumber(f);
|
renumber(f);
|
||||||
break;
|
break;
|
||||||
case CUT:
|
case CUT:
|
||||||
case CUTTOEND:
|
|
||||||
undidmsg = _("text cut");
|
undidmsg = _("text cut");
|
||||||
redo_cut(u);
|
redo_cut(u);
|
||||||
break;
|
break;
|
||||||
@ -890,13 +888,12 @@ void add_undo(undo_type current_action)
|
|||||||
u->strdata = data;
|
u->strdata = data;
|
||||||
break;
|
break;
|
||||||
case CUT:
|
case CUT:
|
||||||
case CUTTOEND:
|
|
||||||
u->mark_set = openfile->mark_set;
|
u->mark_set = openfile->mark_set;
|
||||||
if (u->mark_set) {
|
if (u->mark_set) {
|
||||||
u->mark_begin_lineno = openfile->mark_begin->lineno;
|
u->mark_begin_lineno = openfile->mark_begin->lineno;
|
||||||
u->mark_begin_x = openfile->mark_begin_x;
|
u->mark_begin_x = openfile->mark_begin_x;
|
||||||
}
|
}
|
||||||
u->to_end = (current_action == CUTTOEND);
|
u->to_end = (ISSET(CUT_TO_END)) ? TRUE : FALSE;
|
||||||
last_cutu = u;
|
last_cutu = u;
|
||||||
break;
|
break;
|
||||||
case UNCUT:
|
case UNCUT:
|
||||||
@ -951,7 +948,7 @@ void update_undo(undo_type action)
|
|||||||
/* Change to an add if we're not using the same undo struct
|
/* Change to an add if we're not using the same undo struct
|
||||||
that we should be using */
|
that we should be using */
|
||||||
if (action != fs->last_action
|
if (action != fs->last_action
|
||||||
|| (action != CUT && action != CUTTOEND && action != INSERT
|
|| (action != CUT && action != INSERT
|
||||||
&& openfile->current->lineno != fs->current_undo->lineno)) {
|
&& openfile->current->lineno != fs->current_undo->lineno)) {
|
||||||
add_undo(action);
|
add_undo(action);
|
||||||
return;
|
return;
|
||||||
@ -1016,7 +1013,8 @@ void update_undo(undo_type action)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case CUT:
|
case CUT:
|
||||||
case CUTTOEND:
|
if (!cutbuffer)
|
||||||
|
break;
|
||||||
if (u->cutbuffer)
|
if (u->cutbuffer)
|
||||||
free(u->cutbuffer);
|
free(u->cutbuffer);
|
||||||
u->cutbuffer = copy_filestruct(cutbuffer);
|
u->cutbuffer = copy_filestruct(cutbuffer);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user