diff mcabber/src/screen.c @ 285:edc263a5d350

Add /alias command Add /alias command and update completion sytem. Aliases are expanded before cmd_get() is called.
author Mikael Berthe <mikael@lilotux.net>
date Thu, 07 Jul 2005 23:25:20 +0100
parents f562b9af2de7
children 1eea0fa0955e
line wrap: on
line diff
--- a/mcabber/src/screen.c	Thu Jul 07 22:12:29 2005 +0100
+++ b/mcabber/src/screen.c	Thu Jul 07 23:25:20 2005 +0100
@@ -1374,12 +1374,23 @@
     row = &inputLine[1];
     compl_categ = COMPL_CMD;
   } else {              // Other completion, depending on the command
-    cmd *com = cmd_get(inputLine);
-    if (!com || !row) {
+    int alias = FALSE;
+    cmd *com;
+    char *xpline = expandalias(inputLine);
+    com = cmd_get(xpline);
+    if (xpline != inputLine) {
+      // This is an alias, so we can't complete rows > 0
+      alias = TRUE;
+      g_free(xpline);
+    }
+    if ((!com && (!alias || !completion_started)) || !row) {
       scr_LogPrint("I cannot complete that...");
       return;
     }
-    compl_categ = com->completion_flags[nrow-1];
+    if (!alias)
+      compl_categ = com->completion_flags[nrow-1];
+    else
+      compl_categ = 0;
   }
 
   if (!completion_started) {