diff --git a/terminal.h b/terminal.h index fcb321c4..03659744 100644 --- a/terminal.h +++ b/terminal.h @@ -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 */ diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 5c629519..3e12a4ba 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -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; diff --git a/windows/window.c b/windows/window.c index be7b4379..73f0751c 100644 --- a/windows/window.c +++ b/windows/window.c @@ -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;