tweaks: rewrap and reindent a few lines

master
Benno Schulenberg 2021-01-29 10:52:40 +01:00
parent dc745c0b77
commit 36855544d1
1 changed files with 10 additions and 14 deletions

View File

@ -2664,9 +2664,8 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
* looking only after an end match, if there is one. */
index = (paintlen == 0) ? 0 : endmatch.rm_eo;
while (regexec(varnish->start, line->data + index,
1, &startmatch, (index == 0) ?
0 : REG_NOTBOL) == 0) {
while (regexec(varnish->start, line->data + index, 1, &startmatch,
(index == 0) ? 0 : REG_NOTBOL) == 0) {
/* Make the match relative to the beginning of the line. */
startmatch.rm_so += index;
startmatch.rm_eo += index;
@ -2676,22 +2675,19 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
thetext = converted + actual_x(converted, start_col);
if (regexec(varnish->end, line->data + startmatch.rm_eo,
1, &endmatch, (startmatch.rm_eo == 0) ?
0 : REG_NOTBOL) == 0) {
if (regexec(varnish->end, line->data + startmatch.rm_eo, 1, &endmatch,
(startmatch.rm_eo == 0) ? 0 : REG_NOTBOL) == 0) {
/* Make the match relative to the beginning of the line. */
endmatch.rm_so += startmatch.rm_eo;
endmatch.rm_eo += startmatch.rm_eo;
/* Only paint the match if it is visible on screen
* and it is more than zero characters long. */
if (endmatch.rm_eo > from_x &&
endmatch.rm_eo > startmatch.rm_so) {
if (endmatch.rm_eo > from_x && endmatch.rm_eo > startmatch.rm_so) {
paintlen = actual_x(thetext, wideness(line->data,
endmatch.rm_eo) - from_col - start_col);
wattron(edit, varnish->attributes);
mvwaddnstr(edit, row, margin + start_col,
thetext, paintlen);
mvwaddnstr(edit, row, margin + start_col, thetext, paintlen);
wattroff(edit, varnish->attributes);
line->multidata[varnish->id] = JUSTONTHIS;
@ -2710,7 +2706,7 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
/* There is no end on this line. But maybe on later lines? */
end_line = line->next;
while (end_line != NULL && regexec(varnish->end, end_line->data,
while (end_line && regexec(varnish->end, end_line->data,
0, NULL, 0) == REG_NOMATCH)
end_line = end_line->next;