(self, new_topvisible, stopline=1, stopindent=0)
return lines, lastindent
Return a list of block line tuples and the 'last' indent.

        The tuple fields are (linenum, indent, text, opener).
        The list represents header lines from new_topvisible back to
        stopline with successively shorter indents > stopindent.
        The list is returned ordered by line number.
        Last indent returned is the smallest indent observed.
Return a list of block line tuples and the 'last' indent.
Return a list of block line tuples and the last indent .
def get_context(self, new_topvisible, stopline=1, stopindent=0):
        """Return a list of block line tuples and the 'last' indent.

        The tuple fields are (linenum, indent, text, opener).
        The list represents header lines from new_topvisible back to
        stopline with successively shorter indents > stopindent.
        The list is returned ordered by line number.
        Last indent returned is the smallest indent observed.
        """
        assert stopline > 0
        lines = []
        # The indentation level we are currently in.
        lastindent = INFINITY
        # For a line to be interesting, it must begin with a block opening
        # keyword, and have less indentation than lastindent.
        for linenum in range(new_topvisible, stopline-1, -1):
            codeline = self.text.get(f'{linenum}.0', f'{linenum}.end')
            indent, text, opener = get_line_info(codeline)
            if indent < lastindent:
                lastindent = indent
                if opener in ("else", "elif"):
                    # Also show the if statement.
                    lastindent += 1
                if opener and linenum < new_topvisible and indent >= stopindent:
                    lines.append((linenum, indent, text, opener))
                if lastindent <= stopindent:
                    break
        lines.reverse()
        return lines, lastindent
def get_context ( self , new_topvisible , stopline = 1 , stopindent = 0 ) : assert stopline > 0 lines = [ ] # The indentation level we are currently in. lastindent = INFINITY # For a line to be interesting, it must begin with a block opening # keyword, and have less indentation than lastindent. for linenum in range ( new_topvisible , stopline - 1 , - 1 ) : codeline = self . text . get ( f'{linenum}.0' , f'{linenum}.end' ) indent , text , opener = get_line_info ( codeline ) if indent < lastindent : lastindent = indent if opener in ( "else" , "elif" ) : # Also show the if statement. lastindent += 1 if opener and linenum < new_topvisible and indent >= stopindent : lines . append ( ( linenum , indent , text , opener ) ) if lastindent <= stopindent : break lines . reverse ( ) return lines , lastindent