1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Cleanup: make symbolic names for CONF_bold_style bits.

CONF_bold_style is a pair of bit flags rather than an enum, so its
values aren't just BOLD_STYLE_FONT and BOLD_STYLE_COLOUR but also the
bitwise OR of them. (Hopefully not neither.)
This commit is contained in:
Simon Tatham 2023-05-29 15:51:56 +01:00
parent dfa91dfa8f
commit fd9bc8c86a
4 changed files with 16 additions and 8 deletions

View File

@ -2420,9 +2420,9 @@ void setup_config_box(struct controlbox *b, bool midsession,
ctrl_radiobuttons(s, "Indicate bolded text by changing:", 'b', 3, ctrl_radiobuttons(s, "Indicate bolded text by changing:", 'b', 3,
HELPCTX(colours_bold), HELPCTX(colours_bold),
conf_radiobutton_handler, I(CONF_bold_style), conf_radiobutton_handler, I(CONF_bold_style),
"The font", I(1), "The font", I(BOLD_STYLE_FONT),
"The colour", I(2), "The colour", I(BOLD_STYLE_COLOUR),
"Both", I(3)); "Both", I(BOLD_STYLE_FONT | BOLD_STYLE_COLOUR));
str = dupprintf("Adjust the precise colours %s displays", appname); str = dupprintf("Adjust the precise colours %s displays", appname);
s = ctrl_getset(b, "Window/Colours", "adjust", str); s = ctrl_getset(b, "Window/Colours", "adjust", str);

View File

@ -512,6 +512,12 @@ enum {
CURSOR_BLOCK, CURSOR_UNDERLINE, CURSOR_VERTICAL_LINE CURSOR_BLOCK, CURSOR_UNDERLINE, CURSOR_VERTICAL_LINE
}; };
enum {
/* these are really bit flags */
BOLD_STYLE_FONT = 1,
BOLD_STYLE_COLOUR = 2,
};
enum { enum {
SER_PAR_NONE, SER_PAR_ODD, SER_PAR_EVEN, SER_PAR_MARK, SER_PAR_SPACE SER_PAR_NONE, SER_PAR_ODD, SER_PAR_EVEN, SER_PAR_MARK, SER_PAR_SPACE
}; };

View File

@ -3896,11 +3896,11 @@ static void do_text_internal(
truecolour.fg = truecolour.bg; truecolour.fg = truecolour.bg;
truecolour.bg = trgb; truecolour.bg = trgb;
} }
if ((inst->bold_style & 2) && (attr & ATTR_BOLD)) { if ((inst->bold_style & BOLD_STYLE_COLOUR) && (attr & ATTR_BOLD)) {
if (nfg < 16) nfg |= 8; if (nfg < 16) nfg |= 8;
else if (nfg >= 256) nfg |= 1; else if (nfg >= 256) nfg |= 1;
} }
if ((inst->bold_style & 2) && (attr & ATTR_BLINK)) { if ((inst->bold_style & BOLD_STYLE_COLOUR) && (attr & ATTR_BLINK)) {
if (nbg < 16) nbg |= 8; if (nbg < 16) nbg |= 8;
else if (nbg >= 256) nbg |= 1; else if (nbg >= 256) nbg |= 1;
} }
@ -3920,7 +3920,7 @@ static void do_text_internal(
widefactor = 1; widefactor = 1;
} }
if ((attr & ATTR_BOLD) && (inst->bold_style & 1)) { if ((attr & ATTR_BOLD) && (inst->bold_style & BOLD_STYLE_FONT)) {
bold = true; bold = true;
fontid |= 1; fontid |= 1;
} else { } else {

View File

@ -1402,9 +1402,11 @@ static void init_fonts(WinGuiSeat *wgs, int pick_width, int pick_height)
for (i = 0; i < FONT_MAXNO; i++) for (i = 0; i < FONT_MAXNO; i++)
wgs->fonts[i] = NULL; wgs->fonts[i] = NULL;
wgs->bold_font_mode = conf_get_int(wgs->conf, CONF_bold_style) & 1 ? wgs->bold_font_mode =
conf_get_int(wgs->conf, CONF_bold_style) & BOLD_STYLE_FONT ?
BOLD_FONT : BOLD_NONE; BOLD_FONT : BOLD_NONE;
wgs->bold_colours = conf_get_int(wgs->conf, CONF_bold_style) & 2 ? wgs->bold_colours =
conf_get_int(wgs->conf, CONF_bold_style) & BOLD_STYLE_COLOUR ?
true : false; true : false;
wgs->und_mode = UND_FONT; wgs->und_mode = UND_FONT;