nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 5d27910d6d1352cdb1d454ce1751758642c9cfe1
parent a955b332e3d6d442c545bd847830864d2d3d9e2a
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Mon,  7 Dec 2015 15:40:07 +0000

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

Diffstat:
MChangeLog | 3+++
Msrc/winio.c | 21+++++++++++----------
2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -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> diff --git a/src/winio.c b/src/winio.c @@ -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; } } }