From 9f6c3a6269cc7a4bc754a3ca4d1252c0a5c9c664 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 14 Aug 2017 11:39:29 +0200
Subject: [PATCH] display: don't doubly show tabs that cross a chunk boundary

This fixes https://savannah.gnu.org/bugs/?51669.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
---
 src/winio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/winio.c b/src/winio.c
index 4fbb30a0..69efa182 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1906,7 +1906,8 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata)
 	} else if (*buf == '\t') {
 	    /* Show a tab as a visible character, or as as a space. */
 #ifndef NANO_TINY
-	    if (ISSET(WHITESPACE_DISPLAY)) {
+	    if (ISSET(WHITESPACE_DISPLAY) && (index > 0 || !isdata ||
+			!ISSET(SOFTWRAP) || column % tabsize == 0)) {
 		int i = 0;
 
 		while (i < whitespace_len[0])
-- 
GitLab