summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-06-28 19:56:05 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-06-28 19:56:05 +0200
commit3f55693400cb3550055dca8607c661130aaa27ab (patch)
tree4891c02471d40d3170300955f63b5eb988f29cf8
parentc9b33846cb15555ee419c5e218ce16f05c589d26 (diff)
downloadxK-3f55693400cb3550055dca8607c661130aaa27ab.tar.gz
xK-3f55693400cb3550055dca8607c661130aaa27ab.tar.xz
xK-3f55693400cb3550055dca8607c661130aaa27ab.zip
degesch: don't put dashes in listings
Just reflecting the behaviour of weechat.
-rw-r--r--degesch.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/degesch.c b/degesch.c
index 9cbd3be..0ca5c9d 100644
--- a/degesch.c
+++ b/degesch.c
@@ -898,7 +898,8 @@ enum buffer_line_flags
BUFFER_LINE_STATUS = 1 << 0, ///< Status message
BUFFER_LINE_ERROR = 1 << 1, ///< Error message
BUFFER_LINE_HIGHLIGHT = 1 << 2, ///< The user was highlighted by this
- BUFFER_LINE_SKIP_FILE = 1 << 3 ///< Don't log this to file
+ BUFFER_LINE_SKIP_FILE = 1 << 3, ///< Don't log this to file
+ BUFFER_LINE_INDENT = 1 << 4 ///< Just indent the line
};
struct buffer_line
@@ -2447,6 +2448,8 @@ buffer_line_display (struct app_context *ctx,
FORMATTER_ADD_ITEM (&f, IGNORE_ATTR, .attribute = 1);
}
+ if (line->flags & BUFFER_LINE_INDENT)
+ formatter_add (&f, " ");
if (line->flags & BUFFER_LINE_STATUS)
formatter_add (&f, " - ");
if (line->flags & BUFFER_LINE_ERROR)
@@ -2538,6 +2541,8 @@ log_full (struct app_context *ctx, struct server *s, struct buffer *buffer,
log_global ((ctx), BUFFER_LINE_STATUS, __VA_ARGS__)
#define log_global_error(ctx, ...) \
log_global ((ctx), BUFFER_LINE_ERROR, __VA_ARGS__)
+#define log_global_indent(ctx, ...) \
+ log_global ((ctx), BUFFER_LINE_INDENT, __VA_ARGS__)
#define log_server_status(s, buffer, ...) \
log_server ((s), (buffer), BUFFER_LINE_STATUS, __VA_ARGS__)
@@ -6035,12 +6040,12 @@ try_decode_buffer (struct app_context *ctx, const char *word)
static void
show_buffers_list (struct app_context *ctx)
{
- log_global_status (ctx, "");
- log_global_status (ctx, "Buffers list:");
+ log_global_indent (ctx, "");
+ log_global_indent (ctx, "Buffers list:");
int i = 1;
LIST_FOR_EACH (struct buffer, iter, ctx->buffers)
- log_global_status (ctx, " [#d] #s", i++, iter->name);
+ log_global_indent (ctx, " [#d] #s", i++, iter->name);
}
static void
@@ -6280,9 +6285,9 @@ handle_command_set (struct handler_args *a)
log_global_error (ctx, "No matches: #s", option);
else if (!*a->arguments)
{
- log_global_status (ctx, "");
+ log_global_indent (ctx, "");
for (size_t i = 0; i < all.len; i++)
- log_global_status (ctx, "#s", all.vector[i]);
+ log_global_indent (ctx, "#s", all.vector[i]);
}
else
result = handle_command_set_assign (ctx, &all, a->arguments);
@@ -6985,17 +6990,17 @@ try_handle_command_help_option (struct app_context *ctx, const char *name)
return true;
}
- log_global_status (ctx, "");
- log_global_status (ctx, "Option \"#s\":", name);
- log_global_status (ctx, " Description: #s", schema->comment);
- log_global_status (ctx, " Type: #s", config_item_type_name (schema->type));
- log_global_status (ctx, " Default: #s",
+ log_global_indent (ctx, "");
+ log_global_indent (ctx, "Option \"#s\":", name);
+ log_global_indent (ctx, " Description: #s", schema->comment);
+ log_global_indent (ctx, " Type: #s", config_item_type_name (schema->type));
+ log_global_indent (ctx, " Default: #s",
schema->default_ ? schema->default_ : "null");
struct str tmp;
str_init (&tmp);
config_item_write (item, false, &tmp);
- log_global_status (ctx, " Current value: #s", tmp.str);
+ log_global_indent (ctx, " Current value: #s", tmp.str);
str_free (&tmp);
return true;
}
@@ -7006,8 +7011,8 @@ handle_command_help (struct handler_args *a)
struct app_context *ctx = a->ctx;
if (!*a->arguments)
{
- log_global_status (ctx, "");
- log_global_status (ctx, "Commands:");
+ log_global_indent (ctx, "");
+ log_global_indent (ctx, "Commands:");
int longest = 0;
for (size_t i = 0; i < N_ELEMENTS (g_command_handlers); i++)
@@ -7018,7 +7023,7 @@ handle_command_help (struct handler_args *a)
for (size_t i = 0; i < N_ELEMENTS (g_command_handlers); i++)
{
struct command_handler *handler = &g_command_handlers[i];
- log_global_status (ctx, " #&s", xstrdup_printf
+ log_global_indent (ctx, " #&s", xstrdup_printf
("%-*s %s", longest, handler->name, handler->description));
}
return true;
@@ -7031,10 +7036,10 @@ handle_command_help (struct handler_args *a)
if (strcasecmp_ascii (command, handler->name))
continue;
- log_global_status (ctx, "");
- log_global_status (ctx, "#s: #s",
+ log_global_indent (ctx, "");
+ log_global_indent (ctx, "#s: #s",
handler->name, handler->description);
- log_global_status (ctx, " Arguments: #s",
+ log_global_indent (ctx, " Arguments: #s",
handler->usage ? handler->usage : "(none)");
return true;
}