Improving debugging messages, and removing superfluous assignment.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4880 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
dfc9a7edd8
commit
ef2cbb7f35
|
@ -2,6 +2,8 @@
|
||||||
* src/winio.c (edit_draw): Poke a non-breaking space into the last
|
* src/winio.c (edit_draw): Poke a non-breaking space into the last
|
||||||
column of every line, to startle the terminal into handling wide,
|
column of every line, to startle the terminal into handling wide,
|
||||||
two-column characters properly. This fixes Savannah bug #31743.
|
two-column characters properly. This fixes Savannah bug #31743.
|
||||||
|
* src/nano.c (precalc_multicolorinfo): Improve debugging messages,
|
||||||
|
and remove superfluous assignment (fileptr already equals endptr).
|
||||||
|
|
||||||
2014-05-13 Benno Schulenberg <bensberg@justemail.net>
|
2014-05-13 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/text.c (do_linter): Make an error message somewhat clearer.
|
* src/text.c (do_linter): Make an error message somewhat clearer.
|
||||||
|
|
28
src/nano.c
28
src/nano.c
|
@ -1846,7 +1846,7 @@ void alloc_multidata_if_needed(filestruct *fileptr)
|
||||||
void precalc_multicolorinfo(void)
|
void precalc_multicolorinfo(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "entering precalc_multicolorinfo()\n");
|
fprintf(stderr, "Entering precalculation of multiline color info\n");
|
||||||
#endif
|
#endif
|
||||||
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
|
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
|
||||||
const colortype *tmpcolor = openfile->colorstrings;
|
const colortype *tmpcolor = openfile->colorstrings;
|
||||||
|
@ -1866,14 +1866,14 @@ void precalc_multicolorinfo(void)
|
||||||
if (tmpcolor->end == NULL)
|
if (tmpcolor->end == NULL)
|
||||||
continue;
|
continue;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "working on color id %d\n", tmpcolor->id);
|
fprintf(stderr, "Starting work on color id %d\n", tmpcolor->id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (fileptr = openfile->fileage; fileptr != NULL; fileptr = fileptr->next) {
|
for (fileptr = openfile->fileage; fileptr != NULL; fileptr = fileptr->next) {
|
||||||
int startx = 0;
|
int startx = 0;
|
||||||
int nostart = 0;
|
int nostart = 0;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "working on lineno %lu\n", (unsigned long) fileptr->lineno);
|
fprintf(stderr, "working on lineno %lu... ", (unsigned long) fileptr->lineno);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
alloc_multidata_if_needed(fileptr);
|
alloc_multidata_if_needed(fileptr);
|
||||||
|
@ -1885,14 +1885,14 @@ void precalc_multicolorinfo(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((nostart = regexec(tmpcolor->start, &fileptr->data[startx], 1, &startmatch, 0)) == 0) {
|
while ((nostart = regexec(tmpcolor->start, &fileptr->data[startx], 1, &startmatch, 0)) == 0) {
|
||||||
/* Look for end, and start marking how many lines are
|
/* Look for an end, and start marking how many lines are
|
||||||
* encompassed which should speed up rendering later. */
|
* encompassed, which should speed up rendering later. */
|
||||||
startx += startmatch.rm_eo;
|
startx += startmatch.rm_eo;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "match found at pos %d...", startx);
|
fprintf(stderr, "start found at pos %d... ", startx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Look on this line first for end. */
|
/* Look first on this line for an end. */
|
||||||
if (regexec(tmpcolor->end, &fileptr->data[startx], 1, &endmatch, 0) == 0) {
|
if (regexec(tmpcolor->end, &fileptr->data[startx], 1, &endmatch, 0) == 0) {
|
||||||
startx += endmatch.rm_eo;
|
startx += endmatch.rm_eo;
|
||||||
fileptr->multidata[tmpcolor->id] |= CSTARTENDHERE;
|
fileptr->multidata[tmpcolor->id] |= CSTARTENDHERE;
|
||||||
|
@ -1905,7 +1905,7 @@ void precalc_multicolorinfo(void)
|
||||||
/* Nice, we didn't find the end regex on this line. Let's start looking for it. */
|
/* Nice, we didn't find the end regex on this line. Let's start looking for it. */
|
||||||
for (endptr = fileptr->next; endptr != NULL; endptr = endptr->next) {
|
for (endptr = fileptr->next; endptr != NULL; endptr = endptr->next) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "advancing to line %lu to find end...\n", (unsigned long) endptr->lineno);
|
fprintf(stderr, "\nadvancing to line %lu to find end... ", (unsigned long) endptr->lineno);
|
||||||
#endif
|
#endif
|
||||||
/* Check for keyboard input, again. */
|
/* Check for keyboard input, again. */
|
||||||
if ((cur_check = time(NULL)) - last_check > 1) {
|
if ((cur_check = time(NULL)) - last_check > 1) {
|
||||||
|
@ -1941,21 +1941,19 @@ void precalc_multicolorinfo(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
alloc_multidata_if_needed(endptr);
|
alloc_multidata_if_needed(endptr);
|
||||||
|
fileptr->multidata[tmpcolor->id] |= CBEGINBEFORE;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "marking line %lu as BEGINBEFORE\n", (unsigned long) fileptr->lineno);
|
fprintf(stderr, "marking line %lu as CBEGINBEFORE\n", (unsigned long) fileptr->lineno);
|
||||||
#endif
|
#endif
|
||||||
endptr->multidata[tmpcolor->id] |= CBEGINBEFORE;
|
/* Skip to the end point of the match. */
|
||||||
/* We should be able to skip all the way to the line of the match.
|
|
||||||
* This may introduce more bugs but it's the Right Thing to do. */
|
|
||||||
fileptr = endptr;
|
|
||||||
startx = endmatch.rm_eo;
|
startx = endmatch.rm_eo;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "jumping to line %lu pos %d to continue\n", (unsigned long) endptr->lineno, startx);
|
fprintf(stderr, "jumping to line %lu pos %d to continue\n", (unsigned long) fileptr->lineno, startx);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (nostart && startx == 0) {
|
if (nostart && startx == 0) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "no start found on line %lu, continuing\n", (unsigned long) fileptr->lineno);
|
fprintf(stderr, "no match\n");
|
||||||
#endif
|
#endif
|
||||||
fileptr->multidata[tmpcolor->id] = CNONE;
|
fileptr->multidata[tmpcolor->id] = CNONE;
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue