softwrap: save firstcolumn when justifying, restore it when unjustifying

In do_justify(), justifying text may change firstcolumn if the paragraph
ends offscreen, and unjustifying the text again will not change it back.
In order to keep the viewport unchanged, we have to save and restore not
just edittop, but firstcolumn as well.
master
David Lawrence Ramsey 2017-01-24 21:37:04 -06:00 committed by Benno Schulenberg
parent 6f0ed2075c
commit 7cd50b8c02
1 changed files with 2 additions and 0 deletions

View File

@ -2160,6 +2160,7 @@ void do_justify(bool full_justify)
/* We save these variables to be restored if the user
* unjustifies. */
filestruct *edittop_save = openfile->edittop;
size_t firstcolumn_save = openfile->firstcolumn;
filestruct *current_save = openfile->current;
size_t current_x_save = openfile->current_x;
#ifndef NANO_TINY
@ -2473,6 +2474,7 @@ void do_justify(bool full_justify)
/* Restore the old position and the mark. */
openfile->edittop = edittop_save;
openfile->firstcolumn = firstcolumn_save;
openfile->current = current_save;
openfile->current_x = current_x_save;
#ifndef NANO_TINY