|
|
|
@ -294,9 +294,15 @@ class ColorTerminalOutput(SaveAttrOutput):
|
|
|
|
|
|
|
|
|
|
def handleColor(self, prevstate, curstate, attrs, tail_attrs):
|
|
|
|
|
"""Обработать изменение цветов (фон и/или тон)"""
|
|
|
|
|
if prevstate.foreground != curstate.foreground:
|
|
|
|
|
# if prevstate.foreground != curstate.foreground:
|
|
|
|
|
# self.handleForeground(prevstate, curstate, attrs, tail_attrs)
|
|
|
|
|
if prevstate.foreground != curstate.foreground or \
|
|
|
|
|
curstate.foreground is not None and prevstate.foreground == curstate.foreground:
|
|
|
|
|
self.handleForeground(prevstate, curstate, attrs, tail_attrs)
|
|
|
|
|
if prevstate.background != curstate.background:
|
|
|
|
|
# if prevstate.background != curstate.background:
|
|
|
|
|
# self.handleBackground(prevstate, curstate, attrs, tail_attrs)
|
|
|
|
|
if prevstate.background != curstate.background or \
|
|
|
|
|
curstate.background is not None and prevstate.background == curstate.background:
|
|
|
|
|
self.handleBackground(prevstate, curstate, attrs, tail_attrs)
|
|
|
|
|
|
|
|
|
|
def _createAttrs(self, prevstate, curstate):
|
|
|
|
@ -320,8 +326,8 @@ class ColorTerminalOutput(SaveAttrOutput):
|
|
|
|
|
self.handleUnderline(prevstate, curstate, attrs, tail_attrs)
|
|
|
|
|
if prevstate.invert != curstate.invert:
|
|
|
|
|
self.handleInvert(prevstate, curstate, attrs, tail_attrs)
|
|
|
|
|
if (prevstate.foreground != curstate.foreground or
|
|
|
|
|
prevstate.background != curstate.background):
|
|
|
|
|
# if (prevstate.foreground != curstate.foreground or
|
|
|
|
|
# prevstate.background != curstate.background):
|
|
|
|
|
self.handleColor(prevstate, curstate, attrs, tail_attrs)
|
|
|
|
|
return attrs, tail_attrs
|
|
|
|
|
|
|
|
|
|