From 7135d6db08610b6d5daf5faa9c3235b695ffa824 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 16 Oct 2022 15:45:09 +0200 Subject: [PATCH] [color] Draw background --- src/viewer/text/draw.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index 65a16e70..5acd4cb8 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -324,12 +324,22 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active) vs = doc_view->vs; if (!vs) { - draw_box(term, box, ' ', 0, &color); + int bgchar = get_opt_int("ui.background_char", ses); +#ifdef CONFIG_UTF8 + draw_box(term, box, bgchar, 0, get_bfu_color(term, "desktop")); +#else + draw_box(term, box, (unsigned char)bgchar, 0, get_bfu_color(term, "desktop")); +#endif return; } if (document_has_frames(doc_view->document)) { - draw_box(term, box, ' ', 0, &color); + int bgchar = get_opt_int("ui.background_char", ses); +#ifdef CONFIG_UTF8 + draw_box(term, box, bgchar, 0, get_bfu_color(term, "desktop")); +#else + draw_box(term, box, (unsigned char)bgchar, 0, get_bfu_color(term, "desktop")); +#endif draw_frame_lines(term, doc_view->document->frame_desc, box->x, box->y, &color); if (vs->current_link == -1) vs->current_link = 0; @@ -380,7 +390,13 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active) } doc_view->last_x = vx; doc_view->last_y = vy; - draw_box(term, box, ' ', 0, &color); + + int bgchar = get_opt_int("ui.background_char", ses); +#ifdef CONFIG_UTF8 + draw_box(term, box, bgchar, 0, get_bfu_color(term, "desktop")); +#else + draw_box(term, box, (unsigned char)bgchar, 0, get_bfu_color(term, "desktop")); +#endif if (!doc_view->document->height) return; while (vs->y >= doc_view->document->height) vs->y -= box->height; @@ -481,11 +497,16 @@ draw_formatted(struct session *ses, int rerender) if (!ses->doc_view || !ses->doc_view->document) { /*INTERNAL("document not formatted");*/ struct el_box box; + int bgchar = get_opt_int("ui.background_char", ses); set_box(&box, 0, 1, ses->tab->term->width, ses->tab->term->height - 2); - draw_box(ses->tab->term, &box, ' ', 0, NULL); +#ifdef CONFIG_UTF8 + draw_box(ses->tab->term, &box, bgchar, 0, get_bfu_color(ses->tab->term, "desktop")); +#else + draw_box(ses->tab->term, &box, (unsigned char)bgchar, 0, get_bfu_color(ses->tab->term, "desktop")); +#endif return; }