Commit 7cd50b8c authored by David Lawrence Ramsey's avatar David Lawrence Ramsey Committed by Benno Schulenberg
Browse files

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.
No related merge requests found
Showing with 2 additions and 0 deletions
+2 -0
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment