Until now, messages (such as errors and warnings) simply had blank
lines in the output viewer summary treeview. This made for funny gaps
and a generally puzzling appearance. This fixes the problem.
\f
/* Working with messages. */
\f
/* Working with messages. */
+const char *
+msg_severity_to_string (enum msg_severity severity)
+{
+ switch (severity)
+ {
+ case MSG_S_ERROR:
+ return _("error");
+ case MSG_S_WARNING:
+ return _("warning");
+ case MSG_S_NOTE:
+ default:
+ return _("note");
+ }
+}
+
/* Duplicate a message */
struct msg *
msg_dup (const struct msg *m)
/* Duplicate a message */
struct msg *
msg_dup (const struct msg *m)
char *
msg_to_string (const struct msg *m, const char *command_name)
{
char *
msg_to_string (const struct msg *m, const char *command_name)
{
struct string s;
ds_init_empty (&s);
struct string s;
ds_init_empty (&s);
ds_put_cstr (&s, ": ");
}
ds_put_cstr (&s, ": ");
}
- switch (m->severity)
- {
- case MSG_S_ERROR:
- label = _("error");
- break;
- case MSG_S_WARNING:
- label = _("warning");
- break;
- case MSG_S_NOTE:
- default:
- label = _("note");
- break;
- }
- ds_put_format (&s, "%s: ", label);
+ ds_put_format (&s, "%s: ", msg_severity_to_string (m->severity));
if (m->category == MSG_C_SYNTAX && command_name != NULL)
ds_put_format (&s, "%s: ", command_name);
if (m->category == MSG_C_SYNTAX && command_name != NULL)
ds_put_format (&s, "%s: ", command_name);
+const char *msg_severity_to_string (enum msg_severity);
+
/* Combination of a category and a severity for convenience. */
enum msg_class
{
/* Combination of a category and a severity for convenience. */
enum msg_class
{
#include "output/cairo.h"
#include "output/chart-item.h"
#include "output/driver-provider.h"
#include "output/cairo.h"
#include "output/chart-item.h"
#include "output/driver-provider.h"
+#include "output/message-item.h"
#include "output/output-item.h"
#include "output/tab.h"
#include "output/table-item.h"
#include "output/output-item.h"
#include "output/tab.h"
#include "output/table-item.h"
ds_clear (&title);
if (is_text_item (item))
ds_put_cstr (&title, text_item_get_text (to_text_item (item)));
ds_clear (&title);
if (is_text_item (item))
ds_put_cstr (&title, text_item_get_text (to_text_item (item)));
+ else if (is_message_item (item))
+ {
+ const struct message_item *msg_item = to_message_item (item);
+ const struct msg *msg = message_item_get_msg (msg_item);
+ ds_put_format (&title, "%s: %s", _("Message"),
+ msg_severity_to_string (msg->severity));
+ }
else if (is_table_item (item))
{
const char *caption = table_item_get_caption (to_table_item (item));
else if (is_table_item (item))
{
const char *caption = table_item_get_caption (to_table_item (item));