aboutsummaryrefslogtreecommitdiff
path: root/format-draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'format-draw.c')
-rw-r--r--format-draw.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/format-draw.c b/format-draw.c
index 6164cc44..1a7e60b3 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)
@@ -1149,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++ = '#';