Index: src/text.c =================================================================== --- src/text.c (revision 5245) +++ src/text.c (working copy) @@ -446,6 +439,7 @@ filestruct *t = 0; size_t len = 0; char *data, *undidmsg = NULL; + bool domore = FALSE; if (!u) { statusbar(_("Nothing in undo buffer!")); @@ -501,6 +495,8 @@ #endif /* !DISABLE_WRAPPING */ case JOIN: undidmsg = _("line join"); + if (ISSET(NO_NEWLINES) || f->next != openfile->filebot || + openfile->filebot->data[0] != '\0' || u->strdata[0] != '\0') { t = make_new_node(f); t->data = mallocstrcpy(NULL, u->strdata); data = mallocstrncpy(NULL, f->data, u->mark_begin_x + 1); @@ -510,6 +506,8 @@ splice_node(f, t, f->next); if (f == openfile->filebot) openfile->filebot = t; + } else + domore = TRUE; goto_line_posx(u->lineno, u->begin); break; case CUT_EOF: @@ -576,6 +574,10 @@ openfile->current_undo = openfile->current_undo->next; openfile->last_action = OTHER; openfile->placewewant = xplustabs(); + + if (domore && openfile->current_undo) + do_undo(); + set_modified(); }