Index: src/cut.c =================================================================== --- src/cut.c (revision 5597) +++ src/cut.c (working copy) @@ -193,10 +193,10 @@ if (cutbuffer != NULL) { if (cb_save != NULL) { cb_save->data += cb_save_len; - copy_from_filestruct(cb_save); + copy_from_filestruct(cb_save, TRUE); cb_save->data -= cb_save_len; } else - copy_from_filestruct(cutbuffer); + copy_from_filestruct(cutbuffer, TRUE); /* Set the current place we want to where the text from the * cutbuffer ends. */ @@ -281,7 +281,7 @@ /* Add a copy of the text in the cutbuffer to the current filestruct * at the current cursor position. */ - copy_from_filestruct(cutbuffer); + copy_from_filestruct(cutbuffer, FALSE); #ifndef NANO_TINY update_undo(PASTE); Index: src/nano.c =================================================================== --- src/nano.c (revision 5597) +++ src/nano.c (working copy) @@ -419,7 +419,7 @@ /* Copy all text from the given filestruct to the current filestruct * at the current cursor position. */ -void copy_from_filestruct(filestruct *somebuffer) +void copy_from_filestruct(filestruct *somebuffer, bool copy_text) { filestruct *top_save; size_t current_x_save = openfile->current_x; @@ -459,8 +459,10 @@ while (openfile->filebot->next != NULL) openfile->filebot = openfile->filebot->next; - /* Put the cursor at the end of the pasted text. */ - openfile->current = openfile->filebot; + /* Put the cursor at the end of the pasted text, if we are not copying + * text. */ + if (!copy_text) + openfile->current = openfile->filebot; openfile->current_x = strlen(openfile->filebot->data); /* Refresh the mark's pointer, and compensate the mark's Index: src/proto.h =================================================================== --- src/proto.h (revision 5597) +++ src/proto.h (working copy) @@ -446,7 +446,7 @@ void unpartition_filestruct(partition **p); void move_to_filestruct(filestruct **file_top, filestruct **file_bot, filestruct *top, size_t top_x, filestruct *bot, size_t bot_x); -void copy_from_filestruct(filestruct *somebuffer); +void copy_from_filestruct(filestruct *somebuffer, bool copy_text); openfilestruct *make_new_opennode(void); void splice_opennode(openfilestruct *begin, openfilestruct *newnode, openfilestruct *end); Index: src/text.c =================================================================== --- src/text.c (revision 5597) +++ src/text.c (working copy) @@ -432,7 +432,7 @@ else goto_line_posx(u->mark_begin_lineno, u->mark_begin_x); - copy_from_filestruct(u->cutbuffer); + copy_from_filestruct(u->cutbuffer, FALSE); if (u->xflags != WAS_MARKED_FORWARD && u->type != PASTE) goto_line_posx(u->mark_begin_lineno, u->mark_begin_x); @@ -723,7 +723,7 @@ case INSERT: redidmsg = _("text insert"); goto_line_posx(u->lineno, u->begin); - copy_from_filestruct(u->cutbuffer); + copy_from_filestruct(u->cutbuffer, FALSE); free_filestruct(u->cutbuffer); u->cutbuffer = NULL; break; @@ -1784,7 +1784,7 @@ /* Copy the paragraph back to the current buffer's filestruct from * the justify buffer. */ - copy_from_filestruct(jusbuffer); + copy_from_filestruct(jusbuffer, FALSE); /* Move upward from the last line of the paragraph to the first * line, putting first_line, edittop, current, and mark_begin at the