From f859f9e2f8e38c83a90b12bb3d2ea8d72606d0ab Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Thu, 17 May 2018 16:26:17 +1000 Subject: [PATCH] Count columns used by ND_SPACE character when splitting lines ND_SPACE take up a printable column, so they need to be counted. Reproducer: /eval echo $repeat(160 $chr(19))XXXXXXXXXXXXXXXXXXXXXXX --- Changelog | 2 ++ source/screen.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index 5de1d29..e97f79c 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2.2] +* Count columns used by ND_SPACE character when splitting lines. (caf) + * Use target window width rather than terminal width to wrap /list -wide output. (caf) diff --git a/source/screen.c b/source/screen.c index f7d63db..a30d7d2 100644 --- a/source/screen.c +++ b/source/screen.c @@ -500,10 +500,11 @@ char **BX_prepare_display(const char *orig_str, /* * Just swallop up any ND's over the max */ - if ((nds_max > 0) && (nds_count > nds_max)) - ; - else + if ((nds_count <= nds_max) || (nds_max <= 0)) + { buffer[pos++] = ND_SPACE; + col++; + } break; } case '\n': /* Forced newline */