nano

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

commit 0e44752ba1474282cbc44a09afefee5c573e4878
parent 20692e0c290de8c89ec3ac8f2df98984a8234605
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 11 Feb 2024 16:25:11 +0100

justify: set the correct starting point also with --cutfromcursor

When --cutfromcursor is active, 'current_x' does need to be zero for
the segment extraction to do the right thing.

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

Bug existed since version 4.0, commit 2500debb.

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

diff --git a/src/text.c b/src/text.c @@ -1849,8 +1849,10 @@ void justify_text(bool whole_buffer) { /* When justifying the entire buffer, start at the top. Otherwise, when * in a paragraph but not at its beginning, move back to its first line. */ - if (whole_buffer) + if (whole_buffer) { openfile->current = openfile->filetop; + openfile->current_x = 0; + } else if (inpar(openfile->current) && !begpar(openfile->current, 0)) do_para_begin(&openfile->current);