about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com>2022-03-20 16:16:44 +0200
committerMarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com>2022-03-21 00:12:12 +0200
commitffeb8c33f1607b6aca8f8b00abbab761247bf9ac (patch)
tree765a5e51c17ee494dad59778bc822705cfe06dc7
parent1afe2aad24224d165493c69ebd1d0523fa777cdc (diff)
downloadprofani-tty-ffeb8c33f1607b6aca8f8b00abbab761247bf9ac.tar.gz
Reverse priority for nick vs cmd autocomplete
-rw-r--r--src/ui/inputwin.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index 9c24377c..d5d7ea00 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -582,19 +582,20 @@ _inp_rl_tab_handler(int count, int key)
         return 0;
     }
 
-    ProfWin* current = wins_get_current();
-    if (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;
         }
     }
 
-    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;
@@ -602,6 +603,7 @@ _inp_rl_tab_handler(int count, int key)
         }
     }
 
+
     return 0;
 }
 
@@ -612,19 +614,20 @@ _inp_rl_shift_tab_handler(int count, int key)
         return 0;
     }
 
-    ProfWin* current = wins_get_current();
-    if (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;
         }
     }
 
-    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;