Commit 0d931376 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey Committed by Benno Schulenberg
Browse files

undo: fix undoing/redoing insertions, since they no longer do partitioning

No related merge requests found
Showing with 3 additions and 12 deletions
+3 -12
...@@ -791,10 +791,7 @@ void do_undo(void) ...@@ -791,10 +791,7 @@ void do_undo(void)
filestruct *oldcutbuffer = cutbuffer, *oldcutbottom = cutbottom; filestruct *oldcutbuffer = cutbuffer, *oldcutbottom = cutbottom;
cutbuffer = NULL; cutbuffer = NULL;
cutbottom = NULL; cutbottom = NULL;
/* Instead of a line number, u->mark_begin_lineno contains the number openfile->mark_begin = fsfromline(u->mark_begin_lineno);
* of lines of the inserted segment, because the file was partitioned
* when update_undo() was called; so, calculate the end-line number. */
openfile->mark_begin = fsfromline(u->lineno + u->mark_begin_lineno - 1);
openfile->mark_begin_x = u->mark_begin_x; openfile->mark_begin_x = u->mark_begin_x;
openfile->mark_set = TRUE; openfile->mark_set = TRUE;
goto_line_posx(u->lineno, u->begin); goto_line_posx(u->lineno, u->begin);
...@@ -855,7 +852,7 @@ void do_redo(void) ...@@ -855,7 +852,7 @@ void do_redo(void)
return; return;
} }
f = fsfromline(u->type == INSERT ? 1 : u->mark_begin_lineno); f = fsfromline(u->mark_begin_lineno);
if (!f) if (!f)
return; return;
...@@ -1434,14 +1431,8 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf ...@@ -1434,14 +1431,8 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
u->lineno = openfile->current->lineno; u->lineno = openfile->current->lineno;
break; break;
case INSERT: case INSERT:
/* Store the number of lines (plus one) of the insertion. */
u->mark_begin_lineno = openfile->current->lineno; u->mark_begin_lineno = openfile->current->lineno;
/* When the insertion contains no newline, store the adjusted u->mark_begin_x = openfile->current_x;
* x position; otherwise, store the length of the last line. */
if (openfile->fileage == openfile->filebot)
u->mark_begin_x = openfile->current_x;
else
u->mark_begin_x = strlen(openfile->filebot->data);
break; break;
case ENTER: case ENTER:
u->strdata = mallocstrcpy(NULL, openfile->current->data); u->strdata = mallocstrcpy(NULL, openfile->current->data);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment