diff --git a/degesch.c b/degesch.c index 74134ae..5c172f5 100644 --- a/degesch.c +++ b/degesch.c @@ -2425,6 +2425,11 @@ static struct config_schema g_config_behaviour[] = .comment = "Input to strftime(3) for the date change line", .type = CONFIG_ITEM_STRING, .default_ = "\"%F\"" }, + { .name = "read_marker_char", + .comment = "The character to use for the read marker line", + .type = CONFIG_ITEM_STRING, + .default_ = "\"-\"", + .validate = config_validate_nonjunk_string }, { .name = "logging", .comment = "Log buffer contents to file", .type = CONFIG_ITEM_BOOLEAN, @@ -4097,7 +4102,28 @@ static void buffer_print_read_marker (struct app_context *ctx, FILE *stream, int flush_opts) { struct formatter f = formatter_make (ctx, NULL); - formatter_add (&f, "#a-- -- -- ---\n", ATTR_READ_MARKER); + const int timestamp_width = 8; // hardcoded to %T right now, simple + const char *marker_char = get_config_string (ctx->config.root, + "behaviour.read_marker_char"); + + // We could turn this off on FLUSH_OPT_NOWRAP, however our default pager + // wraps lines for us even if we don't do it ourselves, and thus there's + // no need to worry about inconsistency. + if (*marker_char) + { + struct str s = str_make (); + for (int i = 0; i < timestamp_width; i++) + str_append (&s, marker_char); + formatter_add (&f, "#a#s#r", ATTR_TIMESTAMP, s.str); + str_reset (&s); + for (int i = timestamp_width; i < g_terminal.columns; i++) + str_append (&s, marker_char); + formatter_add (&f, "#a#s#r\n", ATTR_READ_MARKER, s.str); + str_free (&s); + } + else + formatter_add (&f, "#a-- -- -- ---\n", ATTR_READ_MARKER); + formatter_flush (&f, stream, flush_opts); // Flush the trailing formatting reset item fflush (stream);