1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-06-29 16:17:46 +02:00

fix tab completion in prompt window

This commit is contained in:
Jfreegman 2014-06-29 16:54:27 -04:00
parent 8715e9c41e
commit 61d3f7e63e
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -144,8 +144,18 @@ 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] == '/') {
if (complete_line(ctx, glob_cmd_list, AC_NUM_GLOB_COMMANDS, MAX_CMDNAME_SIZE) == -1)
int diff = complete_line(ctx, 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);
}
} else {
beep();
}
} else {
beep();
}