def _move_position_in_buffer(self, position):
        """
        Return the next position in buffer.
        """
        cursor = self._control.textCursor()
        cursor.setPosition(position)
        line = cursor.blockNumber()
        prompt_line = self._get_prompt_cursor().blockNumber()
        if line == prompt_line:
            if position >= self._prompt_pos:
                return position
            return self._prompt_pos
        if line > prompt_line:
            cursor.movePosition(QtGui.QTextCursor.StartOfBlock)
            prompt_pos = cursor.position() + len(self._continuation_prompt)
            if position >= prompt_pos:
                return position
            return prompt_pos
        return self._prompt_pos

        Return the next position in buffer.
        
angrmanagement/vendor/qtconsole/console_widget.py