aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/nnn.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nnn.c b/src/nnn.c
index f59c071..b2e2845 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1884,9 +1884,11 @@ static char *unescape(const char *str, uint maxcols)
if (maxcols) {
len = lencount = wcswidth(wbuf, len);
+ /* Reduce nuber of wide chars to max columns */
if (len > maxcols)
lencount = maxcols + 1;
+ /* Reduce wide chars one by one till it fits */
while (len > maxcols)
len = wcswidth(wbuf, --lencount);