commit 8efcc24e0e65ac36160daacf86d4acd77b3fe9e7
parent aa8baa3d913b9f1816a15c09af58e04aa90b307a
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date: Fri, 29 Oct 2021 19:37:31 +0530
Fix #1213: scroll long strings in prompts
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git 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);