nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit f11931a0dd4cfc777b74dd59773ab994f3561bd0
parent 31a6931be9e7a00bc94fb8582ef65c3ecb9f9fca
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu,  8 Apr 2021 12:19:34 +0200

tweaks: rename a variable, for contrast with another

The 'start_index' was in index in the given text, while 'index' is an
index in the displayable string.  Having both of them using 'index' in
their name was somewhat confusing.

Diffstat:
Msrc/winio.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -1713,9 +1713,9 @@ char *display_string(const char *text, size_t column, size_t span, { const char *origin = text; /* The beginning of the text, to later determine the covered part. */ - size_t start_index = actual_x(text, column); + size_t start_x = actual_x(text, column); /* The index of the first character that the caller wishes to show. */ - size_t start_col = wideness(text, start_index); + size_t start_col = wideness(text, start_x); /* The actual column where that first character starts. */ size_t stowaways = 20; /* The number of zero-width characters for which to reserve space. */ @@ -1728,7 +1728,7 @@ char *display_string(const char *text, size_t column, size_t span, size_t beyond = column + span; /* The column number just beyond the last shown character. */ - text += start_index; + text += start_x; #ifndef NANO_TINY if (span > HIGHEST_POSITIVE) { @@ -1891,7 +1891,7 @@ char *display_string(const char *text, size_t column, size_t span, converted[index] = '\0'; /* Remember what part of the original text is covered by converted. */ - from_x = start_index; + from_x = start_x; till_x = text - origin; return converted;