From c95cd9ed5e5e89e1ed467dbd5b7d8c80f672a5a1 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 14 Jun 2019 15:35:58 +0000 Subject: Do not loop forever if a menu item contains invisible characters, reported by Thomas Sattler. --- format-draw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'format-draw.c') diff --git a/format-draw.c b/format-draw.c index f8882ac2..b589ca5e 100644 --- a/format-draw.c +++ b/format-draw.c @@ -791,7 +791,8 @@ format_width(const char *expanded) } else if (*cp > 0x1f && *cp < 0x7f) { width++; cp++; - } + } else + cp++; } return (width); } -- cgit From 2da050413c17e587be8bede710112096ce6b5f5a Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 1 Jul 2019 06:56:00 +0000 Subject: Add a "fill" style attribute to clear the entire format drawing area in a colour, GitHub issue 1815. --- format-draw.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'format-draw.c') diff --git a/format-draw.c b/format-draw.c index b589ca5e..bb5c65fb 100644 --- a/format-draw.c +++ b/format-draw.c @@ -511,8 +511,9 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base, u_int ocx = os->cx, ocy = os->cy, i, width[TOTAL]; u_int map[] = { LEFT, LEFT, CENTRE, RIGHT }; int focus_start = -1, focus_end = -1; - int list_state = -1; + int list_state = -1, fill = -1; enum style_align list_align = STYLE_ALIGN_DEFAULT; + struct grid_cell gc; struct style sy; struct utf8_data *ud = &sy.gc.data; const char *cp, *end; @@ -590,6 +591,10 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base, style_tostring(&sy)); free(tmp); + /* If this style has a fill colour, store it for later. */ + if (sy.fill != 8) + fill = sy.fill; + /* Check the list state. */ switch (sy.list) { case STYLE_LIST_ON: @@ -711,6 +716,14 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base, fr->argument, names[fr->index], fr->start, fr->end); } + /* Clear the available area. */ + if (fill != -1) { + memcpy(&gc, &grid_default_cell, sizeof gc); + gc.bg = fill; + for (i = 0; i < available; i++) + screen_write_putc(octx, &gc, ' '); + } + /* * Draw the screens. How they are arranged depends on where the list * appearsq. -- cgit From 3635b3cd6c3343b2ec3f7173facef8a284e7e613 Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 6 Jul 2019 20:37:29 +0000 Subject: Correctly clear underscore colour in grid_get_cell1, also fix struct grid_cell to avoid padding. Fixes increased memory use reported by Suraj N Kurapati. --- format-draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'format-draw.c') diff --git a/format-draw.c b/format-draw.c index bb5c65fb..e0ca89f0 100644 --- a/format-draw.c +++ b/format-draw.c @@ -565,7 +565,7 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base, cp++; } - /* Draw the cell to th current screen. */ + /* Draw the cell to the current screen. */ screen_write_cell(&ctx[current], &sy.gc); width[current] += ud->width; continue; -- cgit