Moves the document lines under cursor.

        :param direction: Move direction ( QTextCursor.Down / QTextCursor.Up ). ( QTextCursor.MoveOperation )
        :return: Method success.
        :rtype: bool
559992
def move_lines(self, direction=QTextCursor.Up):
        

        cursor = self.textCursor()
        if (direction == QTextCursor.Up and cursor.block() == cursor.document().firstBlock()) or \
                (direction == QTextCursor.Down and cursor.block() == cursor.document().lastBlock()):
            return False

        self.__select_text_under_cursor_blocks(cursor)
        text = cursor.selectedText()
        cursor.removeSelectedText()
        cursor.deleteChar()

        cursor.setPosition(cursor.block().next().position() if direction == QTextCursor.Down else
                           cursor.block().previous().position())
        if cursor.position() == cursor.document().firstBlock().position() and direction == QTextCursor.Down:
            cursor.movePosition(QTextCursor.End)
            cursor.insertText(QChar(QChar.ParagraphSeparator))

        start_position = cursor.position()
        cursor.insertText(text)
        end_position = cursor.position()
        not cursor.atEnd() and cursor.insertText(QChar(QChar.ParagraphSeparator))

        cursor.setPosition(start_position, QTextCursor.MoveAnchor)
        cursor.setPosition(end_position, QTextCursor.KeepAnchor)
        self.setTextCursor(cursor)

        return True
146953
def onRightUp(self, event=None):
        
        if event is None:
            return
        self.cursor_mode_action('rightup', event=event)
        self.ForwardEvent(event=event.guiEvent)
35514
def move_parent_up(self):
        
        cursor = self.nav.absolute_index
        if cursor > 0:
            level = max(self.content.get(cursor)['level'], 1)
            while self.content.get(cursor - 1)['level'] >= level:
                self._move_cursor(-1)
                cursor -= 1
            self._move_cursor(-1)
        else:
            self.term.flash()

        self.clear_input_queue()
366255
def move_cursor(cols=0, rows=0):
    
    if cols == 0 and rows == 0:
        return
    commands = ""
    commands += codes.cursor["up" if rows < 0 else "down"] * abs(rows)
    commands += codes.cursor["left" if cols < 0 else "right"] * abs(cols)
    if commands:
        print(commands, end="")
        stdout.flush()
901071
def _cursor_forward(self, count=1):
        
        self.x = min(self.size[1] - 1, self.x + count)
76813
def _onShortcutSelectAndScroll(self, down):
        
        cursor = self.textCursor()
        cursor.movePosition(QTextCursor.Down if down else QTextCursor.Up, QTextCursor.KeepAnchor)
        self.setTextCursor(cursor)
        self._onShortcutScroll(down)
490833
function ( direction ) {
			var current = F.current;

			if (current) {
				if (!isString(direction)) {
					direction = current.direction.next;
				}

				F.jumpto(current.index + 1, direction, 'next');
			}
		}
248379
function(direction){
            var directionCoords = {
                up:     {x: 0, y:-1},
                right:  {x: 1, y: 0},
                down:   {x: 0, y: 1},
                left:   {x:-1, y: 0}
            };
            return directionCoords[direction];
        }
131078
def _selectLines(self, startBlockNumber, endBlockNumber):
        
        startBlock = self.document().findBlockByNumber(startBlockNumber)
        endBlock = self.document().findBlockByNumber(endBlockNumber)
        cursor = QTextCursor(startBlock)
        cursor.setPosition(endBlock.position(), QTextCursor.KeepAnchor)
        cursor.movePosition(QTextCursor.EndOfBlock, QTextCursor.KeepAnchor)
        self.setTextCursor(cursor)
319565
def mapToAbsPosition(self, line, column):
        
        block = self.document().findBlockByNumber(line)
        if not block.isValid():
            raise IndexError("Invalid line index %d" % line)
        if column >= block.length():
            raise IndexError("Invalid column index %d" % column)
        return block.position() + column
1308489
def __select_text_under_cursor_blocks(self, cursor):
        

        start_block = self.document().findBlock(cursor.selectionStart()).firstLineNumber()
        end_block = self.document().findBlock(cursor.selectionEnd()).firstLineNumber()
        cursor.setPosition(self.document().findBlockByLineNumber(start_block).position())
        cursor.movePosition(QTextCursor.StartOfLine, QTextCursor.MoveAnchor)
        cursor.movePosition(QTextCursor.Down, QTextCursor.KeepAnchor, end_block - start_block)
        cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor)
832426
function move(node, stayWithin, directionIsNext) {
  if (directionIsNext) {
    return NodeTraversal.next(node, stayWithin);
  } else {
    if (node === stayWithin) {
      return null;
    }
    return NodeTraversal.previous(node, null);
  }
}
136061
def accel_move_tab_right(self, *args):
        # TODO KEYBINDINGS ONLY
        
        pos = self.get_notebook().get_current_page()
        if pos != self.get_notebook().get_n_pages() - 1:
            self.move_tab(pos, pos + 1)
        return True
1085210
def auto_up(self, count=1, go_to_start_of_line_if_history_changes=False):
        
        if self.complete_state:
            self.complete_previous(count=count)
        elif self.document.cursor_position_row > 0:
            self.cursor_up(count=count)
        elif not self.selection_state:
            self.history_backward(count=count)

            # Go to the start of the line?
            if go_to_start_of_line_if_history_changes:
                self.cursor_position += self.document.get_start_of_line_position()
121937
def _move_cursor_to_line(self, line):
        
        last_line = self._text_edit.document().blockCount() - 1
        self._cursor.clearSelection()
        self._cursor.movePosition(self._cursor.End)
        to_insert = ''
        for i in range(line - last_line):
            to_insert += '\n'
        if to_insert:
            self._cursor.insertText(to_insert)
        self._cursor.movePosition(self._cursor.Start)
        self._cursor.movePosition(self._cursor.Down, self._cursor.MoveAnchor, line)
        self._last_cursor_pos = self._cursor.position()
182046
function(start, end, direction) {
      var current = (start = startOfLine(start)), before = start && startOfLine(start.previousSibling);
      if (!isBR(end)) end = endOfLine(end, this.container);
      this.addDirtyNode(start);

      do {
        var next = endOfLine(current, this.container);
        if (current) this.highlight(before, next, true);
        this.indentLineAfter(current, direction);
        before = current;
        current = next;
      } while (current != end);
      select.setCursorPos(this.container, {node: start, offset: 0}, {node: end, offset: 0});
    }
282143
def join_next_line(self, separator=' '):
        
        if not self.document.on_last_line:
            self.cursor_position += self.document.get_end_of_line_position()
            self.delete()

            # Remove spaces.
            self.text = (self.document.text_before_cursor + separator +
                         self.document.text_after_cursor.lstrip(' '))