def printText(self, y, x, printer, maxLen):
        printedSoFar = 0
        for index, val in enumerate(self.segments):
            if printedSoFar >= maxLen:
                break
            if index % 2 == 1:
                # text
                toPrint = val[0:maxLen - printedSoFar]
                printer.addstr(y, x + printedSoFar, toPrint,
                               ColorPrinter.CURRENT_COLORS)
                printedSoFar += len(toPrint)
            else:
                # formatting
                printer.setAttributes(*self.parseFormatting(val))
Print out using ncurses. Note that if any formatting changes
dataset/ETHPy150Open facebook/PathPicker/src/formattedText.py/FormattedText.printText