nano

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

commit 08fd5b349b3628412a76fef3e2de9f6aa2203ffb
parent 6971db773b8cbbb49b4740a20d722843705adbc1
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Thu, 11 May 2017 10:52:39 +0200

moving: limit the target column when it is beyond the last chunk

When the column given in gotoline() is beyond the last available
column in the row of the last chunk, then set placewewant to the
actual end of the chunk, to prevent surprising jumps to the left
when moving up or down from there.

This fixes https://savannah.gnu.org/bugs/?50995.

Diffstat:
Msrc/search.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/search.c b/src/search.c @@ -883,6 +883,12 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, openfile->current_x = actual_x(openfile->current->data, column - 1); openfile->placewewant = column - 1; +#ifndef NANO_TINY + if (ISSET(SOFTWRAP) && openfile->placewewant / editwincols > + strlenpt(openfile->current->data) / editwincols) + openfile->placewewant = strlenpt(openfile->current->data); +#endif + /* When the position was manually given, center the target line. */ if (interactive) { adjust_viewport(CENTERING);