Fix #1213: scroll long strings in prompts

This commit is contained in:
Arun Prakash Jana 2021-10-29 19:37:31 +05:30
parent aa8baa3d91
commit 8efcc24e0e
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 7 additions and 2 deletions

View File

@ -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);