def fold_text_ctx(self, line):
        """
        Folds text, via :class:`DomTerm`, if available.
        Notes that this temporarily overwrites self.lines.

        :param str line: always visible
        """
        if not self.dom_term:
            self.__call__(line)
            yield
            return
        self.lines, old_lines = [], self.lines  # overwrite self.lines
        yield  # collect output (in new self.lines)
        self.lines, new_lines = old_lines, self.lines  # recover self.lines
        hidden_text = "".join(new_lines)
        import io
        output_buf = io.StringIO()
        prefix = ""
        while line[:1] == " ":
            prefix += " "
            line = line[1:]
        self.dom_term.fold_text(line, hidden=hidden_text, file=output_buf, align=len(prefix))
        output_text = prefix[1:] + output_buf.getvalue()
        self.lines.append(output_text)
def fold_text_ctx ( self , line ) : if not self . dom_term : self . __call__ ( line ) yield return self . lines , old_lines = [ ] , self . lines yield self . lines , new_lines = old_lines , self . lines hidden_text = "" . join ( new_lines ) import io output_buf = io . StringIO ( ) prefix = "" while line [ : 1 ] == " " : prefix += " " line = line [ 1 : ] self . dom_term . fold_text ( line , hidden = hidden_text , file = output_buf , align = len ( prefix ) ) output_text = prefix [ 1 : ] + output_buf . getvalue ( ) self . lines . append ( output_text )
Folds text, via :class:`DomTerm`, if available.
        Notes that this temporarily overwrites self.lines.

        :param str line: always visible