about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_ac.c1
-rw-r--r--src/command/cmd_defs.c5
-rw-r--r--src/command/cmd_funcs.c32
3 files changed, 37 insertions, 1 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index c996d814..f9d5a22a 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -785,6 +785,7 @@ cmd_ac_init(void)
     autocomplete_add(statusbar_ac, "show");
     autocomplete_add(statusbar_ac, "hide");
     autocomplete_add(statusbar_ac, "maxtabs");
+    autocomplete_add(statusbar_ac, "tablen");
     autocomplete_add(statusbar_ac, "self");
     autocomplete_add(statusbar_ac, "chat");
     autocomplete_add(statusbar_ac, "room");
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index d6ee9be6..418155c4 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -1361,6 +1361,7 @@ static struct cmd_t command_defs[] =
             "/statusbar show name|number",
             "/statusbar hide name|number",
             "/statusbar maxtabs <value>",
+            "/statusbar tablen <value>",
             "/statusbar self user|barejid|fulljid|off",
             "/statusbar chat user|jid",
             "/statusbar room room|jid",
@@ -1370,6 +1371,7 @@ static struct cmd_t command_defs[] =
             "Manage statusbar display preferences.")
         CMD_ARGS(
             { "maxtabs <value>",            "Set the maximum number of tabs to display, <value> must be between 0 and 10" },
+            { "tablen <value>",             "Set the maximum number of characters to show as the tab name, 0 sets to unlimited." },
             { "show|hide name",             "Show or hide names in tabs." },
             { "show|hide number",           "Show or hide numbers in tabs." },
             { "self user|barejid|fulljid",  "Show account user name, barejid, fulljid as status bar title." },
@@ -1379,7 +1381,8 @@ static struct cmd_t command_defs[] =
             { "up",                         "Move the status bar up the screen." },
             { "down",                       "Move the status bar down the screen." })
         CMD_EXAMPLES(
-            "/statusbar maxtabs 5",
+            "/statusbar maxtabs 8",
+            "/statusbar tablen 5",
             "/statusbar self user",
             "/statusbar chat jid",
             "/statusbar hide name")
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 11f1f51c..c8aa22b4 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -5846,6 +5846,38 @@ cmd_statusbar(ProfWin *window, const char *const command, gchar **args)
         }
     }
 
+    if (g_strcmp0(args[0], "tablen") == 0) {
+        if (args[1] == NULL) {
+            cons_bad_cmd_usage(command);
+            return TRUE;
+        }
+
+        char *value = args[1];
+        int intval = 0;
+        char *err_msg = NULL;
+        gboolean res = strtoi_range(value, &intval, 0, INT_MAX, &err_msg);
+        if (res) {
+            if (intval < 0) {
+                cons_bad_cmd_usage(command);
+                return TRUE;
+            }
+
+            prefs_set_statusbartablen(intval);
+            if (intval == 0) {
+                cons_show("Maximum tab length disabled.");
+            } else {
+                cons_show("Maximum tab length set to %d.", intval);
+            }
+            ui_resize();
+            return TRUE;
+        } else {
+            cons_show(err_msg);
+            cons_bad_cmd_usage(command);
+            free(err_msg);
+            return TRUE;
+        }
+    }
+
     if (g_strcmp0(args[0], "self") == 0) {
         if (g_strcmp0(args[1], "barejid") == 0) {
             prefs_set_string(PREF_STATUSBAR_SELF, "barejid");