Commit 5f30775d authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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.
No related merge requests found
Showing with 2 additions and 3 deletions
+2 -3
......@@ -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 ||
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment