From 4f3249de569b5f90df53e65e1bcd9d0913d7ce65 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Sun, 9 Jul 2017 15:35:48 -0500
Subject: [PATCH] display: when converting tabs, don't go beyond the screen
 width

This fixes https://savannah.gnu.org/bugs/?51427.
---
 src/winio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/winio.c b/src/winio.c
index 17b258bd..a89b2aa0 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1902,7 +1902,7 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata)
 		converted[index++] = ' ';
 	    column++;
 	    /* Fill the tab up with the required number of spaces. */
-	    while (column % tabsize != 0) {
+	    while (column % tabsize != 0 && column < beyond) {
 		converted[index++] = ' ';
 		column++;
 	    }
-- 
GitLab