From: Arun Prakash Jana Date: Fri, 29 Oct 2021 14:07:31 +0000 (+0530) Subject: Fix #1213: scroll long strings in prompts X-Git-Tag: v4.4~27 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=8efcc24e0e65ac36160daacf86d4acd77b3fe9e7;p=nnn.git Fix #1213: scroll long strings in prompts --- 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);