From: Chris Allegretta Date: Sun, 15 Nov 2015 07:09:13 +0000 (+0000) Subject: Backport r5400 from trunk. X-Git-Tag: v2.4.3~1 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=ca11b36620c42a5b0fa4a4a41907572ee7ee91b4;p=nano.git Backport r5400 from trunk. git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_2_4_branch@5423 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 4fea3f53..76dae20b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-11-11 Benno Schulenberg + * 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. + 2015-11-10 Benno Schulenberg * src/winio.c (edit_draw): Skip a zero-length match only when there /is/ a match. Found with valgrind. This fixes Savannah bug #41908. diff --git a/src/text.c b/src/text.c index 82038154..dce34eee 100644 --- a/src/text.c +++ b/src/text.c @@ -628,8 +628,17 @@ void do_redo(void) break; case ENTER: redidmsg = _("line break"); - goto_line_posx(u->lineno, u->begin); - do_enter(TRUE); + filestruct *shoveline = make_new_node(f); + shoveline->data = mallocstrcpy(NULL, u->strdata); + data = mallocstrncpy(NULL, f->data, u->begin + 1); + data[u->begin] = '\0'; + free(f->data); + f->data = data; + splice_node(f, shoveline, f->next); + if (f == openfile->filebot) + openfile->filebot = shoveline; + renumber(shoveline); + goto_line_posx(u->lineno + 1, u->mark_begin_x); break; #ifndef DISABLE_WRAPPING case SPLIT_BEGIN: @@ -1116,6 +1125,7 @@ fprintf(stderr, " >> Updating... action = %d, fs->last_action = %d, openfile->c u->mark_begin_lineno = openfile->current->lineno; break; case ENTER: + u->strdata = mallocstrcpy(NULL, fs->current->data); u->mark_begin_x = fs->current_x; break; #ifndef DISABLE_WRAPPING