about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com>2022-03-03 09:59:21 +0200
committerMarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com>2022-03-03 09:59:21 +0200
commit1afe2aad24224d165493c69ebd1d0523fa777cdc (patch)
treecd0121793015e64a9d4f7eb425b5ed560ab4b4a2
parent81b5230da520af54f3d6d81a54c87b38cdd628fe (diff)
downloadprofani-tty-1afe2aad24224d165493c69ebd1d0523fa777cdc.tar.gz
Fix not autocompleting nicks with '/'
Remove check for '/' at the beginning of the line before autocompleting
and make it fallback to command autocompletion if no nicks found.

Fixes https://github.com/profanity-im/profanity/issues/1474
-rw-r--r--src/ui/inputwin.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index 4ea773c8..9c24377c 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -583,14 +583,16 @@ _inp_rl_tab_handler(int count, int key)
     }
 
     ProfWin* current = wins_get_current();
-    if ((strncmp(rl_line_buffer, "/", 1) != 0) && (current->type == WIN_MUC)) {
+    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;
             free(result);
         }
-    } else if (strncmp(rl_line_buffer, "/", 1) == 0) {
+    }
+
+    if (strncmp(rl_line_buffer, "/", 1) == 0) {
         ProfWin* window = wins_get_current();
         char* result = cmd_ac_complete(window, rl_line_buffer, FALSE);
         if (result) {
@@ -611,14 +613,16 @@ _inp_rl_shift_tab_handler(int count, int key)
     }
 
     ProfWin* current = wins_get_current();
-    if ((strncmp(rl_line_buffer, "/", 1) != 0) && (current->type == WIN_MUC)) {
+    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;
             free(result);
         }
-    } else if (strncmp(rl_line_buffer, "/", 1) == 0) {
+    }
+
+    if (strncmp(rl_line_buffer, "/", 1) == 0) {
         ProfWin* window = wins_get_current();
         char* result = cmd_ac_complete(window, rl_line_buffer, TRUE);
         if (result) {