Commit 3f1878d9 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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
No related merge requests found
Showing with 12 additions and 4 deletions
+12 -4
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> 2015-07-17 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (open_buffer): Verify that a named and existing file * 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 is a normal file, to avoid opening an empty buffer when the name of
......
...@@ -2603,7 +2603,8 @@ void edit_draw(filestruct *fileptr, const char *converted, int ...@@ -2603,7 +2603,8 @@ void edit_draw(filestruct *fileptr, const char *converted, int
/* If the found start has been qualified as an end earlier, /* If the found start has been qualified as an end earlier,
* believe it and skip to the next step. */ * believe it and skip to the next step. */
if (start_line != NULL && start_line->multidata != NULL && 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; goto step_two;
/* Skip over a zero-length regex match. */ /* Skip over a zero-length regex match. */
...@@ -2678,8 +2679,9 @@ void edit_draw(filestruct *fileptr, const char *converted, int ...@@ -2678,8 +2679,9 @@ void edit_draw(filestruct *fileptr, const char *converted, int
if (paintlen < 0) if (paintlen < 0)
goto end_of_loop; goto end_of_loop;
step_two: step_two:
/* Second step, we look for starts on this line. */ /* Second step: look for starts on this line, but start
start_col = 0; * looking only after an end match, if there is one. */
start_col = (paintlen == 0) ? 0 : endmatch.rm_eo;
while (start_col < endpos) { while (start_col < endpos) {
if (regexec(tmpcolor->start, fileptr->data + if (regexec(tmpcolor->start, fileptr->data +
...@@ -2728,6 +2730,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int ...@@ -2728,6 +2730,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
#endif #endif
} }
} }
start_col = endmatch.rm_eo;
} else { } else {
/* There is no end on this line. But we /* There is no end on this line. But we
* haven't yet looked for one on later * haven't yet looked for one on later
...@@ -2753,11 +2756,11 @@ void edit_draw(filestruct *fileptr, const char *converted, int ...@@ -2753,11 +2756,11 @@ void edit_draw(filestruct *fileptr, const char *converted, int
fileptr->multidata[tmpcolor->id] = CENDAFTER; fileptr->multidata[tmpcolor->id] = CENDAFTER;
break; break;
} }
}
start_col = startmatch.rm_so + 1; start_col = startmatch.rm_so + 1;
} }
} }
} }
}
end_of_loop: end_of_loop:
wattroff(edit, A_BOLD); wattroff(edit, A_BOLD);
wattroff(edit, COLOR_PAIR(tmpcolor->pairnum)); wattroff(edit, COLOR_PAIR(tmpcolor->pairnum));
......
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