commit 0b54785fe5fe8402d9da9be7e1e407a3d617fe4c
parent 8835c0d486a72dd95c8b27f085ae389191bee9ed
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 27 Jan 2020 15:36:37 +0100
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.
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/winio.c b/src/winio.c
@@ -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);