From 8efcc24e0e65ac36160daacf86d4acd77b3fe9e7 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Fri, 29 Oct 2021 19:37:31 +0530 Subject: [PATCH] Fix #1213: scroll long strings in prompts --- src/nnn.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index 40e258f4..aea0b693 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3485,8 +3485,13 @@ static char *xreadline(const char *prefill, const char *prompt) while (1) { buf[len] = ' '; attron(COLOR_PAIR(cfg.curctx + 1)); - mvaddnwstr(xlines - 1, x, buf, len + 1); - move(xlines - 1, x + wcswidth(buf, pos)); + if (pos > (size_t)(xcols - x)) { + mvaddnwstr(xlines - 1, x, buf + (pos - (xcols - x)), xcols - x); + move(xlines - 1, xcols - 1); + } else { + mvaddnwstr(xlines - 1, x, buf, len + 1); + move(xlines - 1, x + wcswidth(buf, pos)); + } attroff(COLOR_PAIR(cfg.curctx + 1)); r = get_wch(ch); -- 2.48.1