commit c888edf409e399363159b356a27c10db545ad5f7
parent 7cd50b8c02a299598e4df9957dc35af35cc0d1ed
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Wed, 25 Jan 2017 01:25:22 -0600
softwrap: save and restore firstcolumn when internally spell-fixing text
In do_int_spell_fix(), spell-checking text may change firstcolumn if
the next match is offscreen, and spell-checking text after that 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:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -2534,6 +2534,7 @@ void do_full_justify(void)
bool do_int_spell_fix(const char *word)
{
char *save_search, *exp_word;
+ size_t firstcolumn_save = openfile->firstcolumn;
size_t current_x_save = openfile->current_x;
filestruct *edittop_save = openfile->edittop;
filestruct *current_save = openfile->current;
@@ -2655,6 +2656,7 @@ bool do_int_spell_fix(const char *word)
/* Restore the viewport to where it was. */
openfile->edittop = edittop_save;
+ openfile->firstcolumn = firstcolumn_save;
/* Restore the settings of the global flags. */
memcpy(flags, stash, sizeof(flags));