mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Make reverse video interact correctly with true colour.
ATTR_REVERSE was being handled in the front ends, and was causing the foreground and background colours to be switched. (I'm not completely sure why I made that design decision; it might be purely historical, but then again, it might also be because reverse video is one effect on the fg and bg colours that must still be performed even in unusual frontend-specific situations like display-driven monochrome mode.) This affected both explicit reverse video enabled using SGR 7, and also the transient reverse video arising from mouse selection. Thanks to Markus Gans for reporting the bug in the latter, which when I investigated it turned out to affect the former as well.
This commit is contained in:
parent
f353e2219e
commit
916a2574d5
@ -103,7 +103,7 @@ struct terminal_tag {
|
||||
#endif /* OPTIMISE_SCROLL */
|
||||
|
||||
int default_attr, curr_attr, save_attr;
|
||||
truecolour curr_truecolour;
|
||||
truecolour curr_truecolour, save_truecolour;
|
||||
termchar basic_erase_char, erase_char;
|
||||
|
||||
bufchain inbuf; /* terminal input buffer */
|
||||
|
@ -3298,9 +3298,15 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len,
|
||||
nfg = ((monochrome ? ATTR_DEFFG : (attr & ATTR_FGMASK)) >> ATTR_FGSHIFT);
|
||||
nbg = ((monochrome ? ATTR_DEFBG : (attr & ATTR_BGMASK)) >> ATTR_BGSHIFT);
|
||||
if (!!(attr & ATTR_REVERSE) ^ (monochrome && (attr & TATTR_ACTCURS))) {
|
||||
struct optionalrgb trgb;
|
||||
|
||||
t = nfg;
|
||||
nfg = nbg;
|
||||
nbg = t;
|
||||
|
||||
trgb = truecolour.fg;
|
||||
truecolour.fg = truecolour.bg;
|
||||
truecolour.bg = trgb;
|
||||
}
|
||||
if ((inst->bold_style & 2) && (attr & ATTR_BOLD)) {
|
||||
if (nfg < 16) nfg |= 8;
|
||||
|
@ -3521,9 +3521,15 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len,
|
||||
if (!fonts[nfont])
|
||||
nfont = FONT_NORMAL;
|
||||
if (attr & ATTR_REVERSE) {
|
||||
struct optionalrgb trgb;
|
||||
|
||||
t = nfg;
|
||||
nfg = nbg;
|
||||
nbg = t;
|
||||
|
||||
trgb = truecolour.fg;
|
||||
truecolour.fg = truecolour.bg;
|
||||
truecolour.bg = trgb;
|
||||
}
|
||||
if (bold_colours && (attr & ATTR_BOLD) && !is_cursor) {
|
||||
if (nfg < 16) nfg |= 8;
|
||||
|
Loading…
Reference in New Issue
Block a user