Looking for a new start only after an end,

instead of right after the last start.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5307 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Benno Schulenberg 2015-07-18 07:34:27 +00:00
parent 6039cd7f6e
commit 3f1878d9a9
2 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2015-07-18 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (edit_draw): When looking for multiline-regex matches,
look for a new start only after an end, instead of right after the
last start. This fixes bug #45525 and bug #41313 on Savannah.
2015-07-17 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (open_buffer): Verify that a named and existing file
is a normal file, to avoid opening an empty buffer when the name of

View File

@ -2603,7 +2603,8 @@ void edit_draw(filestruct *fileptr, const char *converted, int
/* If the found start has been qualified as an end earlier,
* believe it and skip to the next step. */
if (start_line != NULL && start_line->multidata != NULL &&
start_line->multidata[tmpcolor->id] == CBEGINBEFORE)
(start_line->multidata[tmpcolor->id] == CBEGINBEFORE ||
start_line->multidata[tmpcolor->id] == CSTARTENDHERE))
goto step_two;
/* Skip over a zero-length regex match. */
@ -2678,8 +2679,9 @@ void edit_draw(filestruct *fileptr, const char *converted, int
if (paintlen < 0)
goto end_of_loop;
step_two:
/* Second step, we look for starts on this line. */
start_col = 0;
/* Second step: look for starts on this line, but start
* looking only after an end match, if there is one. */
start_col = (paintlen == 0) ? 0 : endmatch.rm_eo;
while (start_col < endpos) {
if (regexec(tmpcolor->start, fileptr->data +
@ -2728,6 +2730,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
#endif
}
}
start_col = endmatch.rm_eo;
} else {
/* There is no end on this line. But we
* haven't yet looked for one on later
@ -2753,8 +2756,8 @@ void edit_draw(filestruct *fileptr, const char *converted, int
fileptr->multidata[tmpcolor->id] = CENDAFTER;
break;
}
start_col = startmatch.rm_so + 1;
}
start_col = startmatch.rm_so + 1;
}
}
}