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
parent
6f0ed2075c
commit
7cd50b8c02
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue