1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Make terminal true-colour mode configurable.

I know some users don't like any colour _at all_, and we have a
separate option to turn off xterm-style 256-colour sequences, so it
seems remiss not to have an option to disable true colour as well.
This commit is contained in:
Simon Tatham 2017-10-05 20:27:27 +01:00
parent 6b824713d5
commit 2f9738a282
7 changed files with 24 additions and 1 deletions

View File

@ -1898,6 +1898,9 @@ void setup_config_box(struct controlbox *b, int midsession,
ctrl_checkbox(s, "Allow terminal to use xterm 256-colour mode", '2',
HELPCTX(colours_xterm256), conf_checkbox_handler,
I(CONF_xterm_256_colour));
ctrl_checkbox(s, "Allow terminal to use 24-bit colours", '4',
HELPCTX(colours_truecolour), conf_checkbox_handler,
I(CONF_true_colour));
ctrl_radiobuttons(s, "Indicate bolded text by changing:", 'b', 3,
HELPCTX(colours_bold),
conf_radiobutton_handler, I(CONF_bold_style),

View File

@ -1549,6 +1549,15 @@ If you do not see \cq{colors#256} in the output, you may need to
change your terminal setting. On modern Linux machines, you could
try \cq{xterm-256color}.
\S{config-truecolour} \q{Allow terminal to use 24-bit colour}
\cfg{winhelp-topic}{colours.truecolour}
This option is enabled by default. If it is disabled, PuTTY will
ignore any control sequences sent by the server which use the control
sequences supported by modern terminals to specify arbitrary 24-bit
RGB colour value.
\S{config-boldcolour} \q{Indicate bolded text by changing...}
\cfg{winhelp-topic}{colours.bold}

View File

@ -859,6 +859,7 @@ void cleanup_exit(int);
/* Colour options */ \
X(INT, NONE, ansi_colour) \
X(INT, NONE, xterm_256_colour) \
X(INT, NONE, true_colour) \
X(INT, NONE, system_colour) \
X(INT, NONE, try_palette) \
X(INT, NONE, bold_style) \

View File

@ -609,6 +609,7 @@ void save_open_settings(void *sesskey, Conf *conf)
write_setting_i(sesskey, "TryPalette", conf_get_int(conf, CONF_try_palette));
write_setting_i(sesskey, "ANSIColour", conf_get_int(conf, CONF_ansi_colour));
write_setting_i(sesskey, "Xterm256Colour", conf_get_int(conf, CONF_xterm_256_colour));
write_setting_i(sesskey, "TrueColour", conf_get_int(conf, CONF_true_colour));
write_setting_i(sesskey, "BoldAsColour", conf_get_int(conf, CONF_bold_style)-1);
for (i = 0; i < 22; i++) {
@ -1005,6 +1006,7 @@ void load_open_settings(void *sesskey, Conf *conf)
gppi(sesskey, "TryPalette", 0, conf, CONF_try_palette);
gppi(sesskey, "ANSIColour", 1, conf, CONF_ansi_colour);
gppi(sesskey, "Xterm256Colour", 1, conf, CONF_xterm_256_colour);
gppi(sesskey, "TrueColour", 1, conf, CONF_true_colour);
i = gppi_raw(sesskey, "BoldAsColour", 1); conf_set_int(conf, CONF_bold_style, i+1);
for (i = 0; i < 22; i++) {

View File

@ -1458,6 +1458,7 @@ void term_copy_stuff_from_conf(Terminal *term)
term->scroll_on_disp = conf_get_int(term->conf, CONF_scroll_on_disp);
term->scroll_on_key = conf_get_int(term->conf, CONF_scroll_on_key);
term->xterm_256_colour = conf_get_int(term->conf, CONF_xterm_256_colour);
term->true_colour = conf_get_int(term->conf, CONF_true_colour);
/*
* Parse the control-character escapes in the configured
@ -5171,7 +5172,6 @@ static void do_paint(Terminal *term, Context ctx, int may_optimise)
tattr = (tattr & ~(ATTR_FGMASK | ATTR_BGMASK)) |
ATTR_DEFFG | ATTR_DEFBG;
tc = d->truecolour;
if (!term->xterm_256_colour) {
int colour;
colour = (tattr & ATTR_FGMASK) >> ATTR_FGSHIFT;
@ -5182,6 +5182,12 @@ static void do_paint(Terminal *term, Context ctx, int may_optimise)
tattr = (tattr &~ ATTR_BGMASK) | ATTR_DEFBG;
}
if (term->true_colour) {
tc = d->truecolour;
} else {
tc.fg = tc.bg = optionalrgb_none;
}
switch (tchar & CSET_MASK) {
case CSET_ASCII:
tchar = term->ucsdata->unitab_line[tchar & 0xFF];

View File

@ -325,6 +325,7 @@ struct terminal_tag {
int scroll_on_disp;
int scroll_on_key;
int xterm_256_colour;
int true_colour;
};
#define in_utf(term) ((term)->utf || (term)->ucsdata->line_codepage==CP_UTF8)

View File

@ -125,6 +125,7 @@
#define WINHELP_CTX_selection_rtf "selection.rtf:config-rtfpaste"
#define WINHELP_CTX_colours_ansi "colours.ansi:config-ansicolour"
#define WINHELP_CTX_colours_xterm256 "colours.xterm256:config-xtermcolour"
#define WINHELP_CTX_colours_truecolour "colours.truecolour:config-truecolour"
#define WINHELP_CTX_colours_bold "colours.bold:config-boldcolour"
#define WINHELP_CTX_colours_system "colours.system:config-syscolour"
#define WINHELP_CTX_colours_logpal "colours.logpal:config-logpalette"