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

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.
No related merge requests found
Showing with 3 additions and 1 deletion
+3 -1
......@@ -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;
......
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