diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index d9d9503e2..1b246191f 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -1278,27 +1278,22 @@ zrefresh(void) offset = predisplaylen; /* increment over it */ if (rhp->start + offset <= tmppos && tmppos < rhp->end + offset) { - if (rhp->atr & (TXTFGCOLOUR|TXTBGCOLOUR)) { - /* override colour with later entry */ - base_atr_on = (base_atr_on & ~TXT_ATTR_ON_VALUES_MASK) | - rhp->atr; - } else { - /* no colour set yet */ + if (rhp->atr & (TXTFGCOLOUR|TXTNOFGCOLOUR|TXTBGCOLOUR|TXTNOBGCOLOUR)) + base_atr_on = rhp->atr; + else base_atr_on |= rhp->atr; - } if (tmppos == rhp->end + offset - 1 || tmppos == tmpll - 1) base_atr_off |= TXT_ATTR_OFF_FROM_ON(rhp->atr); } } - if (special_atr_on & (TXTFGCOLOUR|TXTBGCOLOUR)) { - /* keep colours from special attributes */ - all_atr_on = special_atr_on | - (base_atr_on & ~TXT_ATTR_COLOUR_ON_MASK); - } else { - /* keep colours from standard attributes */ - all_atr_on = special_atr_on | base_atr_on; - } + + all_atr_on = base_atr_on; + if (special_atr_on & (TXTFGCOLOUR|TXTNOFGCOLOUR)) + all_atr_on &= ~(TXT_ATTR_FG_ON_MASK|TXTNOFGCOLOUR); + if (special_atr_on & (TXTBGCOLOUR|TXTNOBGCOLOUR)) + all_atr_on &= ~(TXT_ATTR_BG_ON_MASK|TXTNOBGCOLOUR); + all_atr_on |= special_atr_on; all_atr_off = TXT_ATTR_OFF_FROM_ON(all_atr_on); if (t == scs) /* if cursor is here, remember it */