nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 7cd50b8c02a299598e4df9957dc35af35cc0d1ed
parent 6f0ed2075c502e346ff219628cb102cd33581cf5
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Tue, 24 Jan 2017 21:37:04 -0600

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.

Diffstat:
Msrc/text.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/text.c b/src/text.c @@ -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