- files.c:
do_insertfile()
- Make sure the mark is always properly positioned after
- inserting a one-line file with the mark on. (DLR)
+ inserting a file with the mark on. (DLR)
copy_file()
- Assert that inn and out don't both point to the same file.
(DLR)
the mark on by properly preserving the beginning of the mark.
(DLR, found by Paul Goins)
- Make sure the mark is always properly positioned after
- uncutting one line of text with the mark on. (DLR)
+ uncutting text with the mark on. (DLR)
- prompt.c:
do_yesno_prompt()
- Remove redundant check for NO_HELP's being FALSE. (DLR)
#ifndef NANO_TINY
if (openfile->mark_set)
do_mark_shift = (openfile->current_x <=
- openfile->mark_begin_x);
+ openfile->mark_begin_x ||
+ openfile->current->lineno <=
+ openfile->mark_begin->lineno);
+
#endif
#ifdef ENABLE_MULTIBUFFER
}
openfile->current_x;
}
#endif
- openfile->current_x += strlen(filepart->top_data);
+ openfile->current_x += current_x_save;
}
+#ifndef NANO_TINY
+ else if (openfile->mark_set && do_mark_shift)
+ openfile->mark_begin_x -= current_x_save;
+#endif
/* Update the current y-coordinate to account for the
* number of lines inserted. */
void copy_from_filestruct(filestruct *file_top, filestruct *file_bot)
{
filestruct *top_save;
+ size_t current_x_save = openfile->current_x;
bool edittop_inside;
#ifndef NANO_TINY
bool do_mark_shift = FALSE;
edittop_inside = (openfile->edittop == openfile->fileage);
#ifndef NANO_TINY
if (openfile->mark_set)
- do_mark_shift = (openfile->current_x <= openfile->mark_begin_x);
+ do_mark_shift = (openfile->current_x <=
+ openfile->mark_begin_x || openfile->current->lineno <=
+ openfile->mark_begin->lineno);
#endif
/* Put the top and bottom of the filestruct at copies of file_top
openfile->mark_begin_x += openfile->current_x;
}
#endif
- openfile->current_x += strlen(filepart->top_data);
+ openfile->current_x += current_x_save;
}
+#ifndef NANO_TINY
+ else if (openfile->mark_set && do_mark_shift)
+ openfile->mark_begin_x -= current_x_save;
+#endif
/* Get the number of characters in the copied text, and add it to
* totsize. */