I was frustrated with default autoaka behavior too. This patch adds
option "defakaargs" which regulates max allowed displayed words after
command. Default value is 0 (current behavior), setting :defakaargs 1
causes screen to rename the title to command name and 1st argument,
:defakaargs 2 - 2 arguments and so on. :defakaargs -1 or smaller
causes screen to not display autoaka at all.

-- 
Arthur Skonecki
http://adb.cba.pl
diff --git a/src/ansi.c b/src/ansi.c
index 29fbe0d..ac72975 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -66,6 +66,7 @@ int visual_bell = 0;
 int use_hardstatus = 1;		/* display status line in hs */
 char *printcmd = 0;
 int use_altscreen = 0;		/* enable alternate screen support? */
+int defakaargs = 0;         /* number of command arguments displayed by autoaka */
 
 unsigned char *blank;		/* line filled with spaces */
 unsigned char *null;		/* line filled with '\0' */
@@ -2271,13 +2272,21 @@ FindAKA()
       else
 	wp->w_autoaka = 0;
       line = cp;
-      while (len && *cp != ' ')
+      int aka_word_counter=0;
+      int aka_spaces_counter=0;
+      while (len && aka_spaces_counter < 2 && aka_word_counter <= defakaargs)
 	{
+      if (*cp == ' ')
+      {
+        aka_spaces_counter++;
+        aka_word_counter++;
+      }
+      else aka_spaces_counter = 0;
 	  if (*cp++ == '/')
-	    line = cp;
+        line = cp;
 	  len--;
 	}
-      ChangeAKA(wp, (char *)line, cp - line);
+      ChangeAKA(wp, (char *)line, cp - line - aka_spaces_counter);
     }
   else
     wp->w_autoaka = 0;
diff --git a/src/comm.c b/src/comm.c
index aedfe49..72bf417 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -132,6 +132,7 @@ struct comm comms[RC_LAST + 1] =
   { "crlf",		ARGS_01 },
 #endif
   { "debug",		ARGS_01 },
+  { "defakaargs",	ARGS_01 },
 #ifdef AUTO_NUKE
   { "defautonuke",	ARGS_1 },
 #endif
diff --git a/src/process.c b/src/process.c
index 5176a82..aded6dd 100644
--- a/src/process.c
+++ b/src/process.c
@@ -78,6 +78,7 @@ extern int defnonblock;
 extern int ZombieKey_destroy;
 extern int ZombieKey_resurrect;
 extern int ZombieKey_onerror;
+extern int defakaargs;
 #ifdef AUTO_NUKE
 extern int defautonuke;
 #endif
@@ -2678,6 +2679,17 @@ int key;
         (void)ParseOnOff(act, &nwin_default.lflag);
       break;
 #endif
+    case RC_DEFAKAARGS:
+      if(!args[0])
+      {
+        char buf[256];
+        sprintf(buf, "current displayed autoaka arguments: %d", defakaargs);
+        Msg(0, buf);
+        break;
+      }
+      Msg(0, "displayed autoaka arguments set to: %s", args[0]);
+      defakaargs=atoi(args[0]);
+      break;
     case RC_DEFFLOW:
       if (args[0] && args[1] && args[1][0] == 'i')
 	{

Reply via email to