]> git.wh0rd.org Git - nano.git/commitdiff
Quitting the loop when there is no end match.
authorBenno Schulenberg <bensberg@justemail.net>
Mon, 7 Dec 2015 15:40:07 +0000 (15:40 +0000)
committerBenno Schulenberg <bensberg@justemail.net>
Mon, 7 Dec 2015 15:40:07 +0000 (15:40 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5488 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/winio.c

index 48e8723269622da558412b278b3201d6471094c9..06a981f36941d7d8d54c1fe8b77c48bc360f8d49 100644 (file)
--- 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>
index 42543b7972aa934336ded893c5ce478d16a81982..75960b2ab2fef7abf2b0b8f789a810d9e4461a9b 100644 (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;
                    }
                }
            }