softwrap: suppress the guiding stripe on unaffected chunks

When the guiding stripe (when softwrapping) will be shown in
a later chunk, it shouldn't be shown in the current chunk.

This fixes https://savannah.gnu.org/bugs/?57654.

Bug existed since --guidestripe was introduced, in version 4.0.
master
Benno Schulenberg 2020-01-27 15:36:37 +01:00
parent 8835c0d486
commit 0b54785fe5
1 changed files with 6 additions and 1 deletions

View File

@ -60,6 +60,8 @@ static bool has_more = FALSE;
static bool is_shorter = TRUE;
/* Whether a row's text is narrower than the screen's width. */
#ifndef NANO_TINY
static size_t sequel_column = 0;
/* The starting column of the next chunk when softwrapping. */
static bool recording = FALSE;
/* Whether we are in the process of recording a macro. */
static int *macro_buffer = NULL;
@ -2670,7 +2672,8 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
#ifndef NANO_TINY
if (stripe_column > from_col && !inhelp &&
stripe_column <= from_col + editwincols) {
(sequel_column == 0 || stripe_column <= sequel_column) &&
stripe_column <= from_col + editwincols) {
ssize_t target_column = stripe_column - from_col - 1;
size_t target_x = actual_x(converted, target_column);
char striped_char[MAXCHARLEN];
@ -2831,6 +2834,8 @@ int update_softwrapped_line(linestruct *line)
to_col = get_softwrap_breakpoint(line->data, from_col, &end_of_line);
sequel_column = (end_of_line) ? 0 : to_col;
/* Convert the chunk to its displayable form and draw it. */
converted = display_string(line->data, from_col, to_col - from_col,
TRUE, FALSE);