summaryrefslogtreecommitdiff
path: root/src/actions.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c79
1 files changed, 24 insertions, 55 deletions
diff --git a/src/actions.c b/src/actions.c
index 72d1507..1a12d96 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -5131,9 +5131,8 @@ cmd_gnumber (int interactive UNUSED, struct cmdarg **args)
/* resort the the window in the list */
group_resort_group (g);
-/* FIXME Implement updating of groups bar. */
-// /* Update the window list. */
-// update_window_names (win->win->scr, defaults.window_fmt);
+ /* Update the group list. */
+ update_group_names (current_screen());
}
return cmdret_new (RET_SUCCESS, NULL);
@@ -5145,6 +5144,10 @@ cmd_grename (int interactive UNUSED, struct cmdarg **args)
if (groups_find_group_by_name (ARG_STRING (0), 1))
return cmdret_new (RET_FAILURE, "grename: duplicate group name");
group_rename (rp_current_group, ARG_STRING(0));
+
+ /* Update the group list. */
+ update_group_names (current_screen());
+
return cmdret_new (RET_SUCCESS, NULL);
}
@@ -5167,65 +5170,31 @@ cmd_gselect (int interactive, struct cmdarg **args)
cmdret *
cmd_groups (int interactive, struct cmdarg **args UNUSED)
{
- rp_group *cur;
- int mark_start = 0, mark_end = 0;
- struct sbuf *buffer;
- rp_group *last;
-
- last = group_last_group ();
- buffer = sbuf_new (0);
-
- /* Generate the string. */
- list_for_each_entry (cur, &rp_groups, node)
- {
- char *fmt;
- char separator;
-
- if (cur == rp_current_group)
- mark_start = strlen (sbuf_get (buffer));
-
- /* Pad start of group name with a space for row
- style. non-Interactive always gets a column.*/
- if (defaults.window_list_style == STYLE_ROW && interactive)
- sbuf_concat (buffer, " ");
-
- if(cur == rp_current_group)
- separator = '*';
- else if(cur == last)
- separator = '+';
- else
- separator = '-';
-
- fmt = xsprintf ("%d%c%s", cur->number, separator, cur->name);
- sbuf_concat (buffer, fmt);
- free (fmt);
-
- /* Pad end of group name with a space for row style. */
- if (defaults.window_list_style == STYLE_ROW && interactive)
- {
- sbuf_concat (buffer, " ");
- }
- else
- {
- if (cur->node.next != &rp_groups)
- sbuf_concat (buffer, "\n");
- }
-
- if (cur == rp_current_group)
- mark_end = strlen (sbuf_get (buffer));
- }
+ struct sbuf *group_list = NULL;
+ int dummy;
+ rp_screen *s;
- /* Display it or return it. */
if (interactive)
{
- marked_message (sbuf_get (buffer), mark_start, mark_end);
- sbuf_free (buffer);
+ s = current_screen ();
+ /* This is a yukky hack. If the bar already hidden then show the
+ bar. This handles the case when msgwait is 0 (the bar sticks)
+ and the user uses this command to toggle the bar on and
+ off. OR the timeout is >0 then show the bar. Which means,
+ always show the bar if msgwait is >0 which fixes the case
+ when a command in the prefix hook displays the bar. */
+ if (!hide_bar (s) || defaults.bar_timeout > 0) show_group_bar (s);
+
return cmdret_new (RET_SUCCESS, NULL);
}
else
{
- cmdret *ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get(buffer));
- sbuf_free(buffer);
+ cmdret *ret;
+
+ group_list = sbuf_new (0);
+ get_group_list ("\n", group_list, &dummy, &dummy);
+ ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get (group_list));
+ sbuf_free (group_list);
return ret;
}
}