1
1

softwrap: save and restore firstcolumn when replacing text

In do_replace(), replacing text may change firstcolumn if the next match
is offscreen, and replacing 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.
Этот коммит содержится в:
David Lawrence Ramsey 2017-01-25 00:35:01 -06:00 коммит произвёл Benno Schulenberg
родитель c888edf409
Коммит c1f70185ba

Просмотреть файл

@ -736,7 +736,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
void do_replace(void)
{
filestruct *edittop_save, *begin;
size_t begin_x;
size_t firstcolumn_save, begin_x;
ssize_t numreplaced;
int i;
@ -780,6 +780,7 @@ void do_replace(void)
/* Save where we are. */
edittop_save = openfile->edittop;
firstcolumn_save = openfile->firstcolumn;
begin = openfile->current;
begin_x = openfile->current_x;
@ -787,6 +788,7 @@ void do_replace(void)
/* Restore where we were. */
openfile->edittop = edittop_save;
openfile->firstcolumn = firstcolumn_save;
openfile->current = begin;
openfile->current_x = begin_x;
refresh_needed = TRUE;