mirror of
https://github.com/irssi/irssi.git
synced 2026-08-22 18:12:12 +02:00
Merge dd98b1c772 into 31b9d115b0
This commit is contained in:
commit
b2cff58ac3
2 changed files with 30 additions and 8 deletions
|
|
@ -130,6 +130,7 @@ static void read_settings(void)
|
|||
int old_colors = term_use_colors;
|
||||
int old_colors24 = term_use_colors24;
|
||||
int old_type = term_type;
|
||||
int old_forced = force_colors;
|
||||
|
||||
/* set terminal type */
|
||||
str = settings_get_str("term_charset");
|
||||
|
|
@ -144,8 +145,14 @@ static void read_settings(void)
|
|||
term_set_input_type(term_type);
|
||||
|
||||
/* change color stuff */
|
||||
if (force_colors != settings_get_bool("term_force_colors")) {
|
||||
if (settings_get_bool("term_force_256colors")) {
|
||||
force_colors = 256;
|
||||
}
|
||||
else if (force_colors != settings_get_bool("term_force_colors")) {
|
||||
force_colors = settings_get_bool("term_force_colors");
|
||||
}
|
||||
|
||||
if (old_forced != force_colors) {
|
||||
term_force_colors(force_colors);
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +178,8 @@ void term_common_init(void)
|
|||
#endif
|
||||
settings_add_bool("lookandfeel", "colors", TRUE);
|
||||
settings_add_bool("lookandfeel", "term_force_colors", FALSE);
|
||||
settings_add_bool("lookandfeel", "mirc_blink_fix", FALSE);
|
||||
settings_add_bool("lookandfeel", "mirc_blink_fix", FALSE);
|
||||
settings_add_bool("lookandfeel", "term_force_256colors", FALSE);
|
||||
|
||||
force_colors = FALSE;
|
||||
term_use_colors = term_has_colors() && settings_get_bool("colors");
|
||||
|
|
|
|||
|
|
@ -454,9 +454,12 @@ void terminfo_setup_colors(TERM_REC *term, int force)
|
|||
unsigned int i, color;
|
||||
|
||||
terminfo_colors_deinit(term);
|
||||
|
||||
if (force && term->TI_setf == NULL && term->TI_setaf == NULL)
|
||||
if (force == 256)
|
||||
term->TI_colors = 256;
|
||||
else if (force && term->TI_setf == NULL && term->TI_setaf == NULL)
|
||||
term->TI_colors = 8;
|
||||
else /* if we turn off force we'll need to restore the real setting */
|
||||
term->TI_colors = term_getnum(tcaps[25]);
|
||||
|
||||
if ((term->TI_setf || term->TI_setaf || force) &&
|
||||
term->TI_colors > 0) {
|
||||
|
|
@ -469,8 +472,15 @@ void terminfo_setup_colors(TERM_REC *term, int force)
|
|||
term->TI_colors = 0;
|
||||
term->set_fg = term->set_bg = _ignore_parm;
|
||||
}
|
||||
|
||||
if (term->TI_setaf) {
|
||||
if (force == 256) {
|
||||
/* force 256-color escapes for base colors as well, lets you
|
||||
* have bold font in konsole without bright.
|
||||
*/
|
||||
for (i = 0; i < term->TI_colors; i++) {
|
||||
color = i < 16 ? ansitab[i] : i;
|
||||
term->TI_fg[i] = g_strdup_printf("\033[38;5;%dm", color);
|
||||
}
|
||||
} else if (term->TI_setaf) {
|
||||
for (i = 0; i < term->TI_colors; i++) {
|
||||
color = i < 16 ? ansitab[i] : i;
|
||||
term->TI_fg[i] = g_strdup(tparm(term->TI_setaf, color, 0));
|
||||
|
|
@ -482,8 +492,12 @@ void terminfo_setup_colors(TERM_REC *term, int force)
|
|||
for (i = 0; i < 8; i++)
|
||||
term->TI_fg[i] = g_strdup_printf("\033[%dm", 30+ansitab[i]);
|
||||
}
|
||||
|
||||
if (term->TI_setab) {
|
||||
if (force == 256) {
|
||||
for (i = 0; i < term->TI_colors; i++) {
|
||||
color = i < 16 ? ansitab[i] : i;
|
||||
term->TI_bg[i] = g_strdup_printf("\033[48;5;%dm", color);
|
||||
}
|
||||
} else if (term->TI_setab) {
|
||||
for (i = 0; i < term->TI_colors; i++) {
|
||||
color = i < 16 ? ansitab[i] : i;
|
||||
term->TI_bg[i] = g_strdup(tparm(term->TI_setab, color, 0));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue