screen: examine the whole line when painting, to set the correct info

In order to determine the correct multidata for a line that doesn't
have such data yet, the whole line must be examined, not just the
part that fits within the screen width.

This fixes https://savannah.gnu.org/bugs/?49978.
master
Benno Schulenberg 2017-01-03 21:18:24 +01:00
parent 124a859516
commit 8177e62c18
1 changed files with 4 additions and 10 deletions

View File

@ -2539,11 +2539,10 @@ void edit_draw(filestruct *fileptr, const char *converted, int
* looking only after an end match, if there is one. */ * looking only after an end match, if there is one. */
start_col = (paintlen == 0) ? 0 : endmatch.rm_eo; start_col = (paintlen == 0) ? 0 : endmatch.rm_eo;
while (start_col < endpos) { while (TRUE) {
if (regexec(varnish->start, fileptr->data + start_col, if (regexec(varnish->start, fileptr->data + start_col,
1, &startmatch, (start_col == 0) ? 1, &startmatch, (start_col == 0) ?
0 : REG_NOTBOL) == REG_NOMATCH || 0 : REG_NOTBOL) == REG_NOMATCH)
start_col + startmatch.rm_so >= endpos)
/* No more starts on this line. */ /* No more starts on this line. */
break; break;
@ -2575,16 +2574,13 @@ void edit_draw(filestruct *fileptr, const char *converted, int
strnlenpt(fileptr->data, strnlenpt(fileptr->data,
endmatch.rm_eo) - start - x_start); endmatch.rm_eo) - start - x_start);
assert(0 <= x_start && x_start < editwincols);
mvwaddnstr(edit, line, x_start + margin, mvwaddnstr(edit, line, x_start + margin,
converted + index, paintlen); converted + index, paintlen);
if (paintlen > 0) {
fileptr->multidata[varnish->id] = CSTARTENDHERE; fileptr->multidata[varnish->id] = CSTARTENDHERE;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, " Marking for id %i line %i as CSTARTENDHERE\n", varnish->id, line); fprintf(stderr, " Marking for id %i line %i as CSTARTENDHERE\n", varnish->id, line);
#endif #endif
}
} }
start_col = endmatch.rm_eo; start_col = endmatch.rm_eo;
/* Skip over a zero-length match. */ /* Skip over a zero-length match. */
@ -2604,8 +2600,6 @@ void edit_draw(filestruct *fileptr, const char *converted, int
if (end_line == NULL) if (end_line == NULL)
break; break;
assert(0 <= x_start && x_start < editwincols);
/* Paint the rest of the line. */ /* Paint the rest of the line. */
mvwaddnstr(edit, line, x_start + margin, converted + index, -1); mvwaddnstr(edit, line, x_start + margin, converted + index, -1);
fileptr->multidata[varnish->id] = CENDAFTER; fileptr->multidata[varnish->id] = CENDAFTER;