diff options
author | James Booth <boothj5@gmail.com> | 2012-10-21 23:37:20 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-10-21 23:37:20 +0100 |
commit | 7a1c76fbb7303dc3db11ed12bfa11d0b406a49b4 (patch) | |
tree | 0d31fe1f667c305e167ced77fdeb75f36ab2019d /src/input_win.c | |
parent | 7d5d87ae39d74d6687ef5aaea042b9b28181ff23 (diff) | |
download | profani-tty-7a1c76fbb7303dc3db11ed12bfa11d0b406a49b4.tar.gz |
Added /help parameter autocomplete
Diffstat (limited to 'src/input_win.c')
-rw-r--r-- | src/input_win.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/input_win.c b/src/input_win.c index 218fd427..fb9fec38 100644 --- a/src/input_win.c +++ b/src/input_win.c @@ -162,6 +162,7 @@ inp_get_char(int *ch, char *input, int *size) reset_search_attempts(); reset_login_search(); + help_reset_completer(); cmd_reset_completer(); } } @@ -365,6 +366,22 @@ _handle_edit(const int ch, char *input, int *size) free(auto_msg); free(found); } + + // autocomplete /help command + } else if ((strncmp(input, "/help ", 6) == 0) && (*size > 6)) { + for(i = 6; i < *size; i++) { + inp_cpy[i-6] = input[i]; + } + inp_cpy[(*size) - 6] = '\0'; + found = help_complete(inp_cpy); + if (found != NULL) { + auto_msg = (char *) malloc((6 + (strlen(found) + 1)) * sizeof(char)); + strcpy(auto_msg, "/help "); + strcat(auto_msg, found); + _replace_input(input, auto_msg, size); + free(auto_msg); + free(found); + } } return 1; |