'Handle the "text" state.
Along with regular text, single token formatting codes are handled
in this state too.
@param ch: The character being processed.'

def state_TEXT(self, ch):

    formatName = self._formatCodes.get(ch)
    if (formatName == 'color'):
        self.emit()
        self.state = 'COLOR_FOREGROUND'
    elif (formatName is None):
        self._buffer += ch
    else:
        self.emit()
        if (formatName == 'off'):
            self._attrs = set()
            self.foreground = self.background = None
        else:
            self._attrs.symmetric_difference_update([formatName])
