1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

[options] Introduced ui.background_char. Refs #142

Integer code of background character.
For example:
32 for space
9617 is default value (TV background char).
This commit is contained in:
Witold Filipczyk 2022-03-25 20:44:08 +01:00
parent 33e36dc1e8
commit 8ee9062955
3 changed files with 19 additions and 10 deletions

View File

@ -1524,6 +1524,10 @@ static union option_info config_options_info[] = {
"Changes take effect at the next elinks restart.")),
#endif
INIT_OPT_INT("ui", N_("Background character"),
"background_char", OPT_ZERO, 32, INT_MAX, 0x2591,
N_("Integer value of background character.")),
INIT_OPT_BOOL("ui", N_("Back to exit"),
"back_to_exit", OPT_ZERO, 0,
N_("Going back from initial page exits tab or elinks.")),

View File

@ -1007,12 +1007,13 @@ void
clear_terminal(struct terminal *term)
{
struct el_box box;
int bgchar = get_opt_int("ui.background_char", NULL);
set_box(&box, 0, 0, term->width, term->height);
#ifdef CONFIG_UTF8
draw_box_node(term, &box, 0x2591, 0, get_bfu_color_node(term, "desktop"));
draw_box_node(term, &box, bgchar, 0, get_bfu_color_node(term, "desktop"));
#else
draw_box_node(term, &box, '#', 0, get_bfu_color_node(term, "desktop"));
draw_box_node(term, &box, (unsigned char)bgchar, 0, get_bfu_color_node(term, "desktop"));
#endif
set_cursor(term, 0, 0, 1);
}

View File

@ -324,19 +324,21 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active)
vs = doc_view->vs;
if (!vs) {
int bgchar = get_opt_int("ui.background_char", ses);
#ifdef CONFIG_UTF8
draw_box_node(term, box, 0x2591, 0, get_bfu_color_node(term, "desktop"));
draw_box_node(term, box, bgchar, 0, get_bfu_color_node(term, "desktop"));
#else
draw_box(term, box, ' ', 0, &color);
draw_box_node(term, box, (unsigned char)bgchar, 0, get_bfu_color_node(term, "desktop"));
#endif
return;
}
if (document_has_frames(doc_view->document)) {
int bgchar = get_opt_int("ui.background_char", ses);
#ifdef CONFIG_UTF8
draw_box_node(term, box, 0x2591, 0, get_bfu_color_node(term, "desktop"));
draw_box_node(term, box, bgchar, 0, get_bfu_color_node(term, "desktop"));
#else
draw_box(term, box, ' ', 0, &color);
draw_box_node(term, box, (unsigned char)bgchar, 0, get_bfu_color_node(term, "desktop"));
#endif
draw_frame_lines(term, doc_view->document->frame_desc, box->x, box->y, &color);
if (vs->current_link == -1)
@ -388,10 +390,11 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active)
}
doc_view->last_x = vx;
doc_view->last_y = vy;
int bgchar = get_opt_int("ui.background_char", ses);
#ifdef CONFIG_UTF8
draw_box_node(term, box, 0x2591, 0, get_bfu_color_node(term, "desktop"));
draw_box_node(term, box, bgchar, 0, get_bfu_color_node(term, "desktop"));
#else
draw_box(term, box, ' ', 0, &color);
draw_box_node(term, box, (unsigned char)bgchar, 0, get_bfu_color_node(term, "desktop"));
#endif
if (!doc_view->document->height) return;
@ -493,14 +496,15 @@ 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);
#ifdef CONFIG_UTF8
draw_box_node(ses->tab->term, &box, 0x2591, 0, get_bfu_color_node(ses->tab->term, "desktop"));
draw_box_node(ses->tab->term, &box, bgchar, 0, get_bfu_color_node(ses->tab->term, "desktop"));
#else
draw_box_node(ses->tab->term, &box, '#', 0, get_bfu_color_node(ses->tab->term, "desktop"));
draw_box_node(ses->tab->term, &box, (unsigned char)bgchar, 0, get_bfu_color_node(ses->tab->term, "desktop"));
#endif
return;
}