Skip to content

Commit

Permalink
Flush output before starting a potentially time-consuming
Browse files Browse the repository at this point in the history
search operation. Without this, buffered data may be not
written or only partially written to the screen, so the
screen could look inconsistent while the search operation
is in progress.
Related to #533.
  • Loading branch information
gwsw committed Jun 29, 2024
1 parent 4c86653 commit d67f5b0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions search.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ public POSITION next_unfiltered(POSITION pos)
if (pos_in_header(pos))
return (pos);

flush();
n = hlist_find(&filter_anchor, pos);
while (n != NULL && pos >= n->r.hl_startpos)
{
Expand All @@ -594,6 +595,7 @@ public POSITION prev_unfiltered(POSITION pos)
if (pos_in_header(pos))
return (pos);

flush();
n = hlist_find(&filter_anchor, pos);
while (n != NULL && pos >= n->r.hl_startpos)
{
Expand Down Expand Up @@ -1231,6 +1233,7 @@ static POSITION get_lastlinepos(POSITION pos, POSITION tpos, int sheight)
{
int nlines;

flush();
for (nlines = 0;; nlines++)
{
POSITION npos = forw_line(pos);
Expand Down Expand Up @@ -1526,6 +1529,7 @@ static int search_range(POSITION pos, POSITION endpos, int search_type, int matc
/* When the search wraps around, end at starting position. */
if ((search_type & SRCH_WRAP) && endpos == NULL_POSITION)
endpos = pos;
flush();
for (;;)
{
/*
Expand Down

0 comments on commit d67f5b0

Please sign in to comment.