mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 20:36:22 +00:00
Add max tabs preference for statusbar
This commit is contained in:
@@ -783,6 +783,7 @@ cmd_ac_init(void)
|
||||
autocomplete_add(statusbar_ac, "down");
|
||||
autocomplete_add(statusbar_ac, "show");
|
||||
autocomplete_add(statusbar_ac, "hide");
|
||||
autocomplete_add(statusbar_ac, "maxtabs");
|
||||
|
||||
statusbar_show_ac = autocomplete_new();
|
||||
autocomplete_add(statusbar_show_ac, "empty");
|
||||
|
||||
@@ -1366,19 +1366,19 @@ static struct cmd_t command_defs[] =
|
||||
CMD_SYN(
|
||||
"/statusbar show empty|name",
|
||||
"/statusbar hide empty|name",
|
||||
// "/statusbar maxtabs <value>",
|
||||
"/statusbar maxtabs <value>",
|
||||
"/statusbar up",
|
||||
"/statusbar down")
|
||||
CMD_DESC(
|
||||
"Manage statusbar display preferences.")
|
||||
CMD_ARGS(
|
||||
// { "maxtabs <value>", "Set the maximum number of tabs to display, <value> must be between 0 and 10" },
|
||||
{ "maxtabs <value>", "Set the maximum number of tabs to display, <value> must be between 0 and 10" },
|
||||
{ "show|hide empty", "Show or hide empty tabs." },
|
||||
{ "show|hide name", "Show or hide names in tabs." },
|
||||
{ "up", "Move the status bar up the screen." },
|
||||
{ "down", "Move the status bar down the screen." })
|
||||
CMD_EXAMPLES(
|
||||
// "/statusbar maxtabs 5",
|
||||
"/statusbar maxtabs 5",
|
||||
"/statusbar show empty",
|
||||
"/statusbar hide name")
|
||||
},
|
||||
|
||||
@@ -5827,7 +5827,34 @@ cmd_statusbar(ProfWin *window, const char *const command, gchar **args)
|
||||
}
|
||||
|
||||
if (g_strcmp0(args[0], "maxtabs") == 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 || intval > 10) {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
prefs_set_statusbartabs(intval);
|
||||
if (intval == 0) {
|
||||
cons_show("Status bar tabs disabled.");
|
||||
} else {
|
||||
cons_show("Status bar tabs set to %d.", intval);
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
cons_show(err_msg);
|
||||
cons_bad_cmd_usage(command);
|
||||
free(err_msg);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_strcmp0(args[0], "up") == 0) {
|
||||
|
||||
Reference in New Issue
Block a user