1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00

[options] redraw_all_terminals in case of changing ui colors

This commit is contained in:
Witold Filipczyk 2022-03-21 14:11:39 +01:00
parent 6d6a058e37
commit a583942dfd
4 changed files with 26 additions and 1 deletions

View File

@ -109,6 +109,13 @@ get_bfu_true_color_node(unsigned int node_number)
return &entry->c24;
}
void
reset_bfu_node_number(unsigned int node_number)
{
struct bfu_color_entry *entry = node_entries[node_number];
entry->was_mono = entry->was_color16 = entry->was_color88 = entry->was_color256 = entry->was_color24 = 0;
}
static struct bfu_color_entry *
get_bfu_color_common(struct terminal *term, const char *stylename)
@ -175,6 +182,7 @@ get_bfu_color_common(struct terminal *term, const char *stylename)
entry->node_number = ++node_number_counter;
node_entries[node_number_counter] = entry;
opt->node_number = node_number_counter;
}
/* Always update the color pair. */

View File

@ -34,6 +34,8 @@ struct screen_char *get_bfu_color88_node(unsigned int node_number);
struct screen_char *get_bfu_color256_node(unsigned int node_number);
struct screen_char *get_bfu_true_color_node(unsigned int node_number);
void reset_bfu_node_number(unsigned int node_number);
/** Cleanup after the BFU style cache
*
* Free all resources used by the BFU style cache.

View File

@ -14,6 +14,7 @@
#include "elinks.h"
#include "bfu/dialog.h"
#include "bfu/style.h"
#include "cache/cache.h"
#include "config/conf.h"
#include "config/dialogs.h"
@ -870,6 +871,19 @@ change_hook_ui(struct session *ses, struct option *current, struct option *chang
return 0;
}
static int
change_hook_ui_colors(struct session *ses, struct option *current, struct option *changed)
{
unsigned int node_number = changed->root->node_number;
if (node_number) {
reset_bfu_node_number(node_number);
cls_redraw_all_terminals();
}
return 0;
}
static int
change_hook_ui_double_esc(struct session *ses, struct option *current, struct option *changed)
{
@ -966,6 +980,7 @@ static const struct change_hook_info change_hooks[] = {
{ "document.html", change_hook_html },
{ "document.plain", change_hook_html },
{ "terminal", change_hook_terminal },
{ "ui.colors", change_hook_ui_colors },
{ "ui.double_esc", change_hook_ui_double_esc },
{ "ui.language", change_hook_language },
{ "ui.mouse_disable", change_hook_ui_mouse_disable },

View File

@ -203,7 +203,7 @@ struct option {
union option_value value;
const char *desc;
const char *capt;
unsigned int node;
unsigned int node_number;
struct option *root;