inserting: adjust the desired x position (don't restore the old one)

This makes nano's cursor behavior consistent across 1) typing text by
hand; 2) pasting in text with ^U; 3) inserting text from a file; and
4) redoing with M-E that same typing or pasting or inserting.

This fixes https://savannah.gnu.org/bugs/?49968.
master
Benno Schulenberg 2017-01-01 15:19:14 +01:00
parent 69bd4d1f06
commit 5f30775d62
1 changed files with 2 additions and 3 deletions

View File

@ -1116,7 +1116,6 @@ void do_insertfile(void)
size_t was_current_x = openfile->current_x;
ssize_t was_current_y = openfile->current_y;
bool current_was_at_top = FALSE;
size_t pww_save = openfile->placewewant;
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
functionptrtype func = func_from_key(&i);
#endif
@ -1278,8 +1277,8 @@ void do_insertfile(void)
/* Restore the old edittop. */
openfile->edittop = edittop_save;
/* Restore the old place we want. */
openfile->placewewant = pww_save;
/* Set the desired x position to the current one. */
openfile->placewewant = xplustabs();
/* Mark the file as modified if it changed. */
if (openfile->current->lineno != was_current_lineno ||