'Update the list of visible blocks/lines position'

def update_visible_blocks(self, event):

    self.__visible_blocks[:] = []
    block = self.firstVisibleBlock()
    blockNumber = block.blockNumber()
    top = int(self.blockBoundingGeometry(block).translated(self.contentOffset()).top())
    bottom = (top + int(self.blockBoundingRect(block).height()))
    ebottom_top = 0
    ebottom_bottom = self.height()
    while block.isValid():
        visible = (bottom <= ebottom_bottom)
        if (not visible):
            break
        if block.isVisible():
            self.__visible_blocks.append((top, (blockNumber + 1), block))
        block = block.next()
        top = bottom
        bottom = (top + int(self.blockBoundingRect(block).height()))
        blockNumber = block.blockNumber()
