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.
This commit is contained in:
Benno Schulenberg 2024-02-11 16:25:11 +01:00
parent 20692e0c29
commit 0e44752ba1

View File

@ -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);