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