Quitting the loop when there is no end match.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5488 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-12-07 15:40:07 +00:00
parent a955b332e3
commit 5d27910d6d
2 changed files with 14 additions and 10 deletions

View File

@ -1,3 +1,6 @@
2015-12-07 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (edit_draw): Quit the loop when there is no end match.
GNU nano 2.5.0 - 2015.12.05
2015-12-05 Chris Allegretta <chrisa@asty.org>

View File

@ -2738,20 +2738,21 @@ void edit_draw(filestruct *fileptr, const char *converted, int
0, NULL, 0) == REG_NOMATCH)
end_line = end_line->next;
if (end_line != NULL) {
assert(0 <= x_start && x_start < COLS);
/* If there is no end, we're done on this line. */
if (end_line == NULL)
break;
mvwaddnstr(edit, line, x_start,
converted + index, -1);
fileptr->multidata[tmpcolor->id] = CENDAFTER;
assert(0 <= x_start && x_start < COLS);
/* Paint the rest of the line. */
mvwaddnstr(edit, line, x_start, converted + index, -1);
fileptr->multidata[tmpcolor->id] = CENDAFTER;
#ifdef DEBUG
fprintf(stderr, " Marking for id %i line %i as CENDAFTER\n", tmpcolor->id, line);
#endif
/* We painted to the end of the line, so
* don't bother checking any more starts. */
break;
}
start_col = startmatch.rm_so + 1;
/* We've painted to the end of the line, so don't
* bother checking for any more starts. */
break;
}
}
}