nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 5f30775d62951c15cce40293d5b31e53f6bd89c3
parent 69bd4d1f065f1ebcb15a2360fadbc741a9440bf8
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Sun,  1 Jan 2017 15:19:14 +0100

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.

Diffstat:
Msrc/files.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -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 ||