+2015-11-12 Benno Schulenberg <bensberg@justemail.net>
+ * src/text.c (do_undo, update_undo): Store the correct end position of
+ an inserted file, and use it when undoing. Fixes Savannah bug #46414.
+
2015-11-11 Benno Schulenberg <bensberg@justemail.net>
- * src/text.c (do_redo, update_undo): Redo an Enter from the stored
+ * src/text.c (do_redo, update_undo): Redo an Enter from the stored
undo data, instead of running do_enter() again, because the latter
will behave differently depending on the setting of autoindent.
This addresses Debian bug #793053 reported by Clancy.
* how many lines were inserted due to being partitioned before read_file
* was called. So we add its value here. */
openfile->mark_begin = fsfromline(u->lineno + u->mark_begin_lineno - 1);
- openfile->mark_begin_x = 0;
+ openfile->mark_begin_x = u->mark_begin_x;
openfile->mark_set = TRUE;
goto_line_posx(u->lineno, u->begin);
cut_marked();
u->lineno = openfile->current->lineno;
break;
case INSERT:
+ /* Store the number of lines of the insertion plus one. */
u->mark_begin_lineno = openfile->current->lineno;
+ /* When the insertion contains no newline, store the adjusted
+ * 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;
case ENTER:
u->strdata = mallocstrcpy(NULL, fs->current->data);