1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-03 03:16:46 +02:00

print multiple matches for all tab-complete operations, fix bug when tab-completing at end of line

This commit is contained in:
Jfreegman
2014-07-18 12:42:53 -04:00
parent d4e41d6053
commit 7e667a8028
5 changed files with 47 additions and 46 deletions

View File

@ -177,14 +177,12 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
if (key == '\t') { /* TAB key: auto-completes command */
if (ctx->len > 1 && ctx->line[0] == '/') {
int diff = complete_line(ctx, glob_cmd_list, AC_NUM_GLOB_COMMANDS, MAX_CMDNAME_SIZE);
int diff = complete_line(self, glob_cmd_list, AC_NUM_GLOB_COMMANDS, MAX_CMDNAME_SIZE);
if (diff != -1) {
if (x + diff > x2 - 1) {
wmove(self->window, y, x + diff);
ctx->start += diff;
} else {
wmove(self->window, y, x + diff);
int wlen = wcswidth(ctx->line, sizeof(ctx->line));
ctx->start = wlen < x2 ? 0 : wlen - x2 + 1;
}
} else {
beep();