commit 5864d97590ed6fac3cf5748d309e62c03a4611f6
parent 3ac37642c8c6e77aafa8601e816ef22322f38e59
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Mon, 30 May 2016 10:45:46 +0200
tweaks: harmonize the routine for tabs with the one for spaces
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -1849,18 +1849,19 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
#endif
converted[index++] = ' ';
start_col++;
- /* If buf contains a tab character, interpret it. */
} else if (*buf_mb == '\t') {
+ /* Show a tab as a visible character, or as as a space. */
#ifndef NANO_TINY
if (ISSET(WHITESPACE_DISPLAY)) {
- int i;
+ int i = 0;
- for (i = 0; i < whitespace_len[0]; i++)
- converted[index++] = whitespace[i];
+ while (i < whitespace_len[0])
+ converted[index++] = whitespace[i++];
} else
#endif
converted[index++] = ' ';
start_col++;
+ /* Fill the tab up with the required number of spaces. */
while (start_col % tabsize != 0) {
converted[index++] = ' ';
start_col++;