]> git.wh0rd.org Git - nano.git/commitdiff
Always setting the multidata to CBEGINBEFORE when an end is found,
authorBenno Schulenberg <bensberg@justemail.net>
Sun, 29 Nov 2015 12:31:49 +0000 (12:31 +0000)
committerBenno Schulenberg <bensberg@justemail.net>
Sun, 29 Nov 2015 12:31:49 +0000 (12:31 +0000)
also when the coloured part is horizontally scrolled off.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5451 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/winio.c

index f7e98f978fd843f88ac5183c20f463b06ef38271..c9169455ffaf320e2d6e69c275546e0206457ec7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
        the multidata cache.  This fixes Savannah bug #46543.
        * src/color.c (reset_multis): Reset the multidata a bit less often.
        * src/color.c (reset_multis): Adjust whitespace and comments.
+       * src/winio.c (edit_draw): When an end is found but nothing is painted
+       (because the coloured part is horizontally scrolled off), nevertheless
+       set the multidata to CBEGINBEFORE.  This fixes Savannah bug #46545.
 
 2015-11-28  Benno Schulenberg  <bensberg@justemail.net>
        * src/nano.c (main): Allow the user full control over the values of
index 225ca722800c81ef712aca51db90551576ce8a52..93f868b817bb4b51e4eea9e8cf98ea3afb2891ae 100644 (file)
@@ -2585,6 +2585,9 @@ void edit_draw(filestruct *fileptr, const char *converted, int
                    goto end_of_loop;
                } else if (md == CBEGINBEFORE) {
                    regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
+                   /* If the coloured part is scrolled off, skip it. */
+                   if (endmatch.rm_eo <= startpos)
+                       goto end_of_loop;
                    paintlen = actual_x(converted, strnlenpt(fileptr->data,
                        endmatch.rm_eo) - start);
                    mvwaddnstr(edit, line, 0, converted, paintlen);
@@ -2649,9 +2652,12 @@ void edit_draw(filestruct *fileptr, const char *converted, int
                        end_line = end_line->next;
 
                    /* If no end was found, or it is too early, next step. */
-                   if (end_line == NULL || (end_line == fileptr &&
-                       endmatch.rm_eo <= startpos))
+                   if (end_line == NULL)
+                       goto step_two;
+                   if (end_line == fileptr && endmatch.rm_eo <= startpos) {
+                       fileptr->multidata[tmpcolor->id] = CBEGINBEFORE;
                        goto step_two;
+                   }
 
                    /* Now paint the start of fileptr.  If the start of
                     * fileptr is on a different line from the end,