From 5745bd27fdfd0e806fb3f734966f66f302c76c48 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 26 Oct 2021 12:22:23 +0000 Subject: Do not allow inline styles to replace mode-style for the selected item, from Alexis Hildebrandt in GitHub issue 2946. --- format-draw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'format-draw.c') diff --git a/format-draw.c b/format-draw.c index 6164cc44..1110535f 100644 --- a/format-draw.c +++ b/format-draw.c @@ -677,7 +677,8 @@ format_draw_many(struct screen_write_ctx *ctx, struct style *sy, char ch, /* Draw a format to a screen. */ void format_draw(struct screen_write_ctx *octx, const struct grid_cell *base, - u_int available, const char *expanded, struct style_ranges *srs) + u_int available, const char *expanded, struct style_ranges *srs, + int default_colours) { enum { LEFT, CENTRE, @@ -819,6 +820,10 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base, log_debug("%s: style '%s' -> '%s'", __func__, tmp, style_tostring(&sy)); free(tmp); + if (default_colours) { + sy.gc.bg = base->bg; + sy.gc.fg = base->fg; + } /* If this style has a fill colour, store it for later. */ if (sy.fill != 8) -- cgit From 0fd01f8873ccae655b0f997ca0dc46c42ebe399d Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 22 Feb 2022 11:07:25 +0000 Subject: Initialize copy_width before adjusting it, GitHub issue 3079. --- format-draw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'format-draw.c') diff --git a/format-draw.c b/format-draw.c index 1110535f..1a7e60b3 100644 --- a/format-draw.c +++ b/format-draw.c @@ -1154,13 +1154,13 @@ format_trim_right(const char *expanded, u_int limit) while (*cp != '\0') { if (*cp == '#') { end = format_leading_hashes(cp, &n, &leading_width); + copy_width = leading_width; if (width <= skip) { - if (skip - width >= leading_width) + if (skip - width >= copy_width) copy_width = 0; else copy_width -= (skip - width); - } else - copy_width = leading_width; + } if (copy_width != 0) { if (n == 1) *out++ = '#'; -- cgit