nano

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

commit 9f1431be17706a17640576326cc70d92749ef4b4
parent e1c6ae7cf355f50b57b546b8688b8be2643570d8
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 19 Mar 2024 17:01:49 +0100

justify: keep as much of the marked region onscreen as possible

When the justified region fits in its entirety onscreen, then it should
be shown in its entirety, because the user is probably curious what the
region looks like after justification.  This behavior will mean that
the line above the topline of the screen will still have multidata
(when the syntax has multiline regexes).  When the justified region
does not fit onscreen, then as much as possible should be shown --
meaning that the cursor should be either at the top or the bottom
of the viewport, meaning that it should not be centered.

This fixes https://savannah.gnu.org/bugs/?65482.
The issue was reported by `correctmost`.

Bug existed since version 4.0, since justifying a region was introduced.

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

diff --git a/src/text.c b/src/text.c @@ -1944,6 +1944,9 @@ void justify_text(bool whole_buffer) free(secondary_lead); free(primary_lead); + + /* Keep as much of the marked region onscreen as possible. */ + focusing = FALSE; } else #endif {