nano

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

commit 40b9e68e02522df3d29941ab89b027d84435795f
parent e7491920fd06bdb5eb42303cd84dbb9caca42cb7
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun,  4 Sep 2022 10:40:17 +0200

goto: don't center the current line when the user specified a column only

This does not quite do what I would have liked (scroll only when needed)
when on a softwrapped line and jumping to a different chunk, but... it's
still better than needlessly centering the line.

(The user can still center the line, if that is what they want, by using
a period or a slash instead of a comma.)

This addresses https://savannah.gnu.org/bugs/?63008.

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

diff --git a/src/search.c b/src/search.c @@ -829,9 +829,9 @@ void goto_line_and_column(ssize_t line, ssize_t column, bool retain_answer, openfile->placewewant = breadth(openfile->current->data); #endif - /* When the position was manually given, center the target line. */ + /* When a line number was manually given, center the target line. */ if (interactive) { - adjust_viewport(CENTERING); + adjust_viewport((*answer == ',') ? STATIONARY : CENTERING); refresh_needed = TRUE; } else { int rows_from_tail;