(self, down)
Move line up or down
        Actually, not a selected text, but next or previous block is moved
        TODO keep bookmarks when moving
Move line up or down
        Actually, not a selected text, but next or previous block is moved
        TODO keep bookmarks when moving
Move line up or down Actually not a selected text but next or previous block is moved TODO keep bookmarks when moving
def _onShortcutMoveLine(self, down):
        """Move line up or down
        Actually, not a selected text, but next or previous block is moved
        TODO keep bookmarks when moving
        """
        startBlock, endBlock = self._selectedBlocks()

        startBlockNumber = startBlock.blockNumber()
        endBlockNumber = endBlock.blockNumber()

        def _moveBlock(block, newNumber):
            text = block.text()
            with self:
                del self.lines[block.blockNumber()]
                self.lines.insert(newNumber, text)

        if down:  # move next block up
            blockToMove = endBlock.next()
            if not blockToMove.isValid():
                return

            _moveBlock(blockToMove, startBlockNumber)

            # self._selectLines(startBlockNumber + 1, endBlockNumber + 1)
        else:  # move previous block down
            blockToMove = startBlock.previous()
            if not blockToMove.isValid():
                return

            _moveBlock(blockToMove, endBlockNumber)
def _onShortcutMoveLine ( self , down ) : startBlock , endBlock = self . _selectedBlocks ( ) startBlockNumber = startBlock . blockNumber ( ) endBlockNumber = endBlock . blockNumber ( ) def _moveBlock ( block , newNumber ) : text = block . text ( ) with self : del self . lines [ block . blockNumber ( ) ] self . lines . insert ( newNumber , text ) if down : # move next block up blockToMove = endBlock . next ( ) if not blockToMove . isValid ( ) : return _moveBlock ( blockToMove , startBlockNumber ) # self._selectLines(startBlockNumber + 1, endBlockNumber + 1) else : # move previous block down blockToMove = startBlock . previous ( ) if not blockToMove . isValid ( ) : return _moveBlock ( blockToMove , endBlockNumber )