commit 8db6abc2d844c0ddaf2f04d959e3c3f319b27a0e
parent 7cc31fe6bb2d08c3ca0a273acae82e50850617e0
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date: Sat, 8 Nov 2025 20:56:19 +0530
Fix #2068: handle full-width characters
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/nnn.c b/src/nnn.c
@@ -3707,12 +3707,15 @@ static char *xreadline(const char *prefill, const char *prompt)
while (1) {
buf[len] = ' ';
+ if (len < (READLINE_MAX - 1))
+ buf[len + 1] = ' '; // Handle full-width characters
+
attron(COLOR_PAIR(cfg.curctx + 1));
if (pos > (size_t)(xcols - x)) {
- mvaddnwstr(xlines - 1, x, buf + (pos - (xcols - x) + 1), xcols - x);
+ mvaddnwstr(xlines - 1, x, buf + (pos - (xcols - x) + 1), xcols - x + 1);
move(xlines - 1, xcols - 1);
} else {
- mvaddnwstr(xlines - 1, x, buf, len + 1);
+ mvaddnwstr(xlines - 1, x, buf, len + 2);
move(xlines - 1, x + wcswidth(buf, pos));
}
attroff(COLOR_PAIR(cfg.curctx + 1));