+
+ if (is_text_item (item))
+ {
+ const struct text_item *text_item = to_text_item (item);
+ const char *text = text_item_get_text (text_item);
+ enum text_item_type type = text_item_get_type (text_item);
+
+ if (type == TEXT_ITEM_COMMAND_OPEN)
+ {
+ free (e->command_name);
+ e->command_name = xstrdup (text);
+ }
+ else if (type == TEXT_ITEM_COMMAND_CLOSE)
+ {
+ free (e->command_name);
+ e->command_name = NULL;
+ }
+ }
+ else if (is_message_item (item))
+ {
+ struct message_item *message_item = to_message_item (item);
+ free (message_item->command_name);
+ message_item->command_name = (e->command_name
+ ? xstrdup (e->command_name)
+ : NULL);
+ }
+