mirror of git://git.sv.gnu.org/nano.git
justify: set `x = 0` for the undo item, for when using --cutfromcursor
When --cutfromcursor is active, 'current_x' needs to be set to zero when
doing a justification, so that the correct starting position gets stored
in the undo item. (Without --cutfromcursor, the value of 'current_x'
does not matter.)
This fixes https://savannah.gnu.org/bugs/?65317.
The issue was indirectly reported by `correctmost`.
Bug existed in this form since version 5.0, commit ae5a4ece
.
Between versions 4.0 and 5.0, nano would not eat a line but would
instead crash when undoing a justification that was done with the
cursor away from the left edge.
This commit is contained in:
parent
77d74b5d81
commit
190221c91c
|
@ -1851,7 +1851,6 @@ void justify_text(bool whole_buffer)
|
|||
* in a paragraph but not at its beginning, move back to its first line. */
|
||||
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);
|
||||
|
@ -1866,7 +1865,8 @@ void justify_text(bool whole_buffer)
|
|||
#endif
|
||||
refresh_needed = TRUE;
|
||||
return;
|
||||
}
|
||||
} else
|
||||
openfile->current_x = 0;
|
||||
|
||||
/* Set the starting point of the paragraph. */
|
||||
startline = openfile->current;
|
||||
|
|
Loading…
Reference in New Issue