Commit d76de381 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

in edit_draw(), don't display any statusbar message when we get a

zero-length regex, as we can get one under legitimate circumstances


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3677 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent 5c878088
Showing with 11 additions and 7 deletions
+11 -7
...@@ -420,6 +420,9 @@ CVS code - ...@@ -420,6 +420,9 @@ CVS code -
well as single-line ones. This avoids a segfault when trying well as single-line ones. This avoids a segfault when trying
to color e.g. "start="$" end="$"". (DLR, found by Trevor to color e.g. "start="$" end="$"". (DLR, found by Trevor
Caira) Caira)
- Don't display any statusbar message when we get a zero-length
regex, as we can get one under legitimate circumstances. (DLR,
found by Mike Frysinger)
update_line() update_line()
- Remove unneeded assert. (DLR) - Remove unneeded assert. (DLR)
edit_redraw() edit_redraw()
......
...@@ -2357,11 +2357,11 @@ void edit_draw(const filestruct *fileptr, const char *converted, int ...@@ -2357,11 +2357,11 @@ void edit_draw(const filestruct *fileptr, const char *converted, int
* line. */ * line. */
startmatch.rm_so += k; startmatch.rm_so += k;
startmatch.rm_eo += k; startmatch.rm_eo += k;
if (startmatch.rm_so == startmatch.rm_eo) {
/* Skip over a zero-length regex match. */
if (startmatch.rm_so == startmatch.rm_eo)
startmatch.rm_eo++; startmatch.rm_eo++;
statusbar( else if (startmatch.rm_so < endpos &&
_("Refusing zero-length regex match"));
} else if (startmatch.rm_so < endpos &&
startmatch.rm_eo > startpos) { startmatch.rm_eo > startpos) {
x_start = (startmatch.rm_so <= startpos) ? 0 : x_start = (startmatch.rm_so <= startpos) ? 0 :
strnlenpt(fileptr->data, strnlenpt(fileptr->data,
...@@ -2408,10 +2408,11 @@ void edit_draw(const filestruct *fileptr, const char *converted, int ...@@ -2408,10 +2408,11 @@ void edit_draw(const filestruct *fileptr, const char *converted, int
goto step_two; goto step_two;
start_line = start_line->prev; start_line = start_line->prev;
} }
if (startmatch.rm_so == startmatch.rm_eo) {
/* Skip over a zero-length regex match. */
if (startmatch.rm_so == startmatch.rm_eo)
startmatch.rm_eo++; startmatch.rm_eo++;
statusbar(_("Refusing zero-length regex match")); else {
} else {
/* No start found, so skip to the next step. */ /* No start found, so skip to the next step. */
if (start_line == NULL) if (start_line == NULL)
goto step_two; goto step_two;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment