Unindenting the part that was the 'else'.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5463 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-12-01 13:33:45 +00:00
parent eee07d5755
commit 07e806e7f2
2 changed files with 98 additions and 105 deletions

View File

@ -5,6 +5,7 @@
* src/text.c (redo_cut): Delete two redundant assignments. * src/text.c (redo_cut): Delete two redundant assignments.
* src/winio.c (edit_draw): Move a check to a better place. * src/winio.c (edit_draw): Move a check to a better place.
* src/winio.c (edit_draw): Rename a label and elide an 'else'. * src/winio.c (edit_draw): Rename a label and elide an 'else'.
* src/winio.c (edit_draw): Unindent after previous change.
2015-11-30 Benno Schulenberg <bensberg@justemail.net> 2015-11-30 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (redo_cut, update_undo): When cutting reaches the EOF, * src/text.c (redo_cut, update_undo): When cutting reaches the EOF,

View File

@ -2611,10 +2611,9 @@ void edit_draw(filestruct *fileptr, const char *converted, int
if (startmatch.rm_so == startmatch.rm_eo) if (startmatch.rm_so == startmatch.rm_eo)
goto tail_of_loop; goto tail_of_loop;
{ /* Now start_line is the first line before fileptr containing
/* Now start_line is the first line before fileptr * a start match. Is there a start on that line not followed
* containing a start match. Is there a start on * by an end on that line? */
* this line not followed by an end on this line? */
start_col = 0; start_col = 0;
while (TRUE) { while (TRUE) {
start_col += startmatch.rm_so; start_col += startmatch.rm_so;
@ -2632,13 +2631,11 @@ void edit_draw(filestruct *fileptr, const char *converted, int
/* No later start on this line. */ /* No later start on this line. */
goto step_two; goto step_two;
} }
/* Indeed, there is a start not followed on this /* Indeed, there is a start without an end on that line. */
* line by an end. */
/* We have already checked that there is no end /* We've already checked that there is no end before fileptr
* before fileptr and after the start. Is there an * and after the start. But is there an end after the start
* end after the start at all? We don't paint * at all? We don't paint unterminated starts. */
* unterminated starts. */
end_line = fileptr; end_line = fileptr;
while (end_line != NULL && regexec(tmpcolor->end, while (end_line != NULL && regexec(tmpcolor->end,
end_line->data, 1, &endmatch, 0) == REG_NOMATCH) end_line->data, 1, &endmatch, 0) == REG_NOMATCH)
@ -2652,13 +2649,11 @@ void edit_draw(filestruct *fileptr, const char *converted, int
goto step_two; goto step_two;
} }
/* Now paint the start of fileptr. If the start of /* Now paint the start of fileptr. If the start of fileptr
* fileptr is on a different line from the end, * is on a different line from the end, paintlen is -1, which
* paintlen is -1, meaning that everything on the * means that everything on the line gets painted. Otherwise,
* line gets painted. Otherwise, paintlen is the * paintlen is the expanded location of the end of the match
* expanded location of the end of the match minus * minus the expanded location of the beginning of the page. */
* the expanded location of the beginning of the
* page. */
if (end_line != fileptr) { if (end_line != fileptr) {
paintlen = -1; paintlen = -1;
fileptr->multidata[tmpcolor->id] = CWHOLELINE; fileptr->multidata[tmpcolor->id] = CWHOLELINE;
@ -2666,8 +2661,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
fprintf(stderr, " Marking for id %i line %i as CWHOLELINE\n", tmpcolor->id, line); fprintf(stderr, " Marking for id %i line %i as CWHOLELINE\n", tmpcolor->id, line);
#endif #endif
} else { } else {
paintlen = actual_x(converted, paintlen = actual_x(converted, strnlenpt(fileptr->data,
strnlenpt(fileptr->data,
endmatch.rm_eo) - start); endmatch.rm_eo) - start);
fileptr->multidata[tmpcolor->id] = CBEGINBEFORE; fileptr->multidata[tmpcolor->id] = CBEGINBEFORE;
#ifdef DEBUG #ifdef DEBUG
@ -2675,8 +2669,8 @@ void edit_draw(filestruct *fileptr, const char *converted, int
#endif #endif
} }
mvwaddnstr(edit, line, 0, converted, paintlen); mvwaddnstr(edit, line, 0, converted, paintlen);
/* If the whole line has been painted, don't bother /* If the whole line has been painted, don't bother looking
* looking for any more starts. */ * for any more starts. */
if (paintlen < 0) if (paintlen < 0)
goto tail_of_loop; goto tail_of_loop;
step_two: step_two:
@ -2685,27 +2679,28 @@ void edit_draw(filestruct *fileptr, const char *converted, int
start_col = (paintlen == 0) ? 0 : endmatch.rm_eo; 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 + start_col,
start_col, 1, &startmatch, (start_col == 1, &startmatch, (start_col == 0) ?
0) ? 0 : REG_NOTBOL) == REG_NOMATCH || 0 : REG_NOTBOL) == REG_NOMATCH ||
start_col + startmatch.rm_so >= endpos) start_col + startmatch.rm_so >= endpos)
/* No more starts on this line. */ /* No more starts on this line. */
break; break;
/* Translate the match to be relative to the /* Translate the match to be relative to the
* beginning of the line. */ * beginning of the line. */
startmatch.rm_so += start_col; startmatch.rm_so += start_col;
startmatch.rm_eo += start_col; startmatch.rm_eo += start_col;
x_start = (startmatch.rm_so <= startpos) ? 0 : x_start = (startmatch.rm_so <= startpos) ?
strnlenpt(fileptr->data, 0 : strnlenpt(fileptr->data,
startmatch.rm_so) - start; startmatch.rm_so) - start;
index = actual_x(converted, x_start); index = actual_x(converted, x_start);
if (regexec(tmpcolor->end, fileptr->data + if (regexec(tmpcolor->end, fileptr->data +
startmatch.rm_eo, 1, &endmatch, startmatch.rm_eo, 1, &endmatch,
(startmatch.rm_eo == 0) ? 0 : (startmatch.rm_eo == 0) ?
REG_NOTBOL) == 0) { 0 : REG_NOTBOL) == 0) {
/* Translate the end match to be relative to /* Translate the end match to be relative to
* the beginning of the line. */ * the beginning of the line. */
endmatch.rm_so += startmatch.rm_eo; endmatch.rm_so += startmatch.rm_eo;
@ -2717,8 +2712,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
endmatch.rm_eo > startmatch.rm_so) { endmatch.rm_eo > startmatch.rm_so) {
paintlen = actual_x(converted + index, paintlen = actual_x(converted + index,
strnlenpt(fileptr->data, strnlenpt(fileptr->data,
endmatch.rm_eo) - start - endmatch.rm_eo) - start - x_start);
x_start);
assert(0 <= x_start && x_start < COLS); assert(0 <= x_start && x_start < COLS);
@ -2733,9 +2727,8 @@ void edit_draw(filestruct *fileptr, const char *converted, int
} }
start_col = endmatch.rm_eo; 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
* haven't yet looked for one on later * looked for one on later lines. */
* lines. */
end_line = fileptr->next; end_line = fileptr->next;
while (end_line != NULL && while (end_line != NULL &&
@ -2760,7 +2753,6 @@ void edit_draw(filestruct *fileptr, const char *converted, int
} }
} }
} }
}
tail_of_loop: tail_of_loop:
wattroff(edit, A_BOLD); wattroff(edit, A_BOLD);
wattroff(edit, COLOR_PAIR(tmpcolor->pairnum)); wattroff(edit, COLOR_PAIR(tmpcolor->pairnum));