diff options
author | Michael Vetter <jubalh@iodoru.org> | 2022-03-21 10:06:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-21 10:06:29 +0100 |
commit | 963065775b0f1008b149b80c19620636a35f8d49 (patch) | |
tree | 31af71f325052b5d251d19f1c86f20d64f7e82db | |
parent | 4e95641014c3c81393390c38fcda2a7de0f3ba35 (diff) | |
parent | ffeb8c33f1607b6aca8f8b00abbab761247bf9ac (diff) | |
download | profani-tty-963065775b0f1008b149b80c19620636a35f8d49.tar.gz |
Merge pull request #1646 from MarcoPolo-PasTonMolo/fix/nick-autocomplete
Fix not autocompleting nicks with '/'
-rw-r--r-- | src/ui/inputwin.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index d0762caa..9e34c0b6 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -586,17 +586,20 @@ _inp_rl_tab_handler(int count, int key) return 0; } - ProfWin* current = wins_get_current(); - if ((strncmp(rl_line_buffer, "/", 1) != 0) && (current->type == WIN_MUC)) { - char* result = muc_autocomplete(current, rl_line_buffer, FALSE); + if (strncmp(rl_line_buffer, "/", 1) == 0) { + ProfWin* window = wins_get_current(); + char* result = cmd_ac_complete(window, rl_line_buffer, FALSE); if (result) { rl_replace_line(result, 1); rl_point = rl_end; free(result); + return 0; } - } else if (strncmp(rl_line_buffer, "/", 1) == 0) { - ProfWin* window = wins_get_current(); - char* result = cmd_ac_complete(window, rl_line_buffer, FALSE); + } + + ProfWin* current = wins_get_current(); + if (current->type == WIN_MUC) { + char* result = muc_autocomplete(current, rl_line_buffer, FALSE); if (result) { rl_replace_line(result, 1); rl_point = rl_end; @@ -604,6 +607,7 @@ _inp_rl_tab_handler(int count, int key) } } + return 0; } @@ -614,17 +618,20 @@ _inp_rl_shift_tab_handler(int count, int key) return 0; } - ProfWin* current = wins_get_current(); - if ((strncmp(rl_line_buffer, "/", 1) != 0) && (current->type == WIN_MUC)) { - char* result = muc_autocomplete(current, rl_line_buffer, TRUE); + if (strncmp(rl_line_buffer, "/", 1) == 0) { + ProfWin* window = wins_get_current(); + char* result = cmd_ac_complete(window, rl_line_buffer, TRUE); if (result) { rl_replace_line(result, 1); rl_point = rl_end; free(result); + return 0; } - } else if (strncmp(rl_line_buffer, "/", 1) == 0) { - ProfWin* window = wins_get_current(); - char* result = cmd_ac_complete(window, rl_line_buffer, TRUE); + } + + ProfWin* current = wins_get_current(); + if (current->type == WIN_MUC) { + char* result = muc_autocomplete(current, rl_line_buffer, TRUE); if (result) { rl_replace_line(result, 1); rl_point = rl_end; |