From 6cbb7bc4439d82d5718b6eb0e117de6fa3f16146 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 24 Jan 2021 16:44:38 +0100 Subject: [PATCH] tweaks: frob two fragments of code, to be more readable --- src/winio.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/winio.c b/src/winio.c index fa3ae715..8f1975ce 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2490,7 +2490,7 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col) for (; varnish != NULL; varnish = varnish->next) { size_t index = 0; /* Where in the line we currently begin looking for a match. */ - int start_col; + int start_col = 0; /* The starting column of a piece to paint. Zero-based. */ int paintlen = 0; /* The number of characters to paint. */ @@ -2532,9 +2532,8 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col) if (match.rm_so >= till_x) break; - start_col = (match.rm_so <= from_x) ? - 0 : wideness(line->data, - match.rm_so) - from_col; + if (match.rm_so > from_x) + start_col = wideness(line->data, match.rm_so) - from_col; thetext = converted + actual_x(converted, start_col); @@ -2662,9 +2661,8 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col) startmatch.rm_so += index; startmatch.rm_eo += index; - start_col = (startmatch.rm_so <= from_x) ? - 0 : wideness(line->data, - startmatch.rm_so) - from_col; + if (startmatch.rm_so > from_x) + start_col = wideness(line->data, startmatch.rm_so) - from_col; thetext = converted + actual_x(converted, start_col);