display: account for horizontal scrolling when drawing the guide stripe

That is, draw the stripe relative to the column at which the current
"chunk" starts.

This fixes https://savannah.gnu.org/bugs/?55920.
master
Benno Schulenberg 2019-03-14 16:48:20 +01:00
parent 37be9b54ca
commit 902b4674f9
1 changed files with 4 additions and 3 deletions

View File

@ -2685,12 +2685,13 @@ void edit_draw(filestruct *fileptr, const char *converted,
} }
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
if (stripe_column > 0 && !inhelp) { if (stripe_column > from_col && !inhelp) {
const char *text = converted + actual_x(converted, stripe_column - 1); const ssize_t target_column = stripe_column - from_col - 1;
const char *text = converted + actual_x(converted, target_column);
const char *striped_char = (*text == '\0') ? " " : text; const char *striped_char = (*text == '\0') ? " " : text;
wattron(edit, interface_color_pair[GUIDE_STRIPE]); wattron(edit, interface_color_pair[GUIDE_STRIPE]);
mvwaddnstr(edit, row, margin + stripe_column - 1, striped_char, 1); mvwaddnstr(edit, row, margin + target_column, striped_char, 1);
wattroff(edit, interface_color_pair[GUIDE_STRIPE]); wattroff(edit, interface_color_pair[GUIDE_STRIPE]);
} }