prompt(): handle tab characters
This commit is contained in:
parent
7ff1070bb7
commit
c0074a61d2
1 changed files with 18 additions and 2 deletions
20
ui.c
20
ui.c
|
|
@ -225,10 +225,26 @@ histent_t *histpos = NULL;
|
|||
|
||||
for (;;) {
|
||||
wint_t c;
|
||||
int i, inpos;
|
||||
wmove(pwin, 0, wcslen(msg) + 1);
|
||||
waddwstr(pwin, input);
|
||||
for (i = 0; i < wcslen(input); i++) {
|
||||
if (input[i] == L'\t')
|
||||
waddwstr(pwin, L" ");
|
||||
else {
|
||||
wchar_t s[] = { input[i], '\0' };
|
||||
waddwstr(pwin, s);
|
||||
}
|
||||
}
|
||||
i--;
|
||||
|
||||
wclrtoeol(pwin);
|
||||
wmove(pwin, 0, wcslen(msg) + 1 + pos);
|
||||
for (i = 0, inpos = 0; i < wcslen(input) && i < pos; i++)
|
||||
if (input[i] == L'\t')
|
||||
inpos += 8;
|
||||
else
|
||||
inpos++;
|
||||
|
||||
wmove(pwin, 0, wcslen(msg) + 1 + inpos);
|
||||
wrefresh(pwin);
|
||||
|
||||
if (input_char(pwin, &c) == ERR)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue