# Path: fiddle/config.py
# EDITOR_FONT = 'Consolas'
# 
# EDITOR_FONT_SIZE = 10


import os
import unicodedata
from io import StringIO
from PyQt4 import QtCore, QtGui
from fiddle.config import EDITOR_FONT, EDITOR_FONT_SIZE
                # Get the insert cursor and make sure it's at the end of the console
                cursor = self.textCursor()
                cursor.movePosition(QtGui.QTextCursor.End)
                if self._input_insert_pos < 0:
                    self._input_insert_pos = cursor.position()

                # Scroll view to end of console
                self.setTextCursor(cursor)
                self.ensureCursorVisible()

                # Process the key event
                if event.key() == QtCore.Qt.Key_Up:
                    # Clear any previous input
                    self._clear_insert_line(cursor)
                    # Get the history
                    if len(self.history) > 0:
                        self.history_idx -= 1
                        try:
                            cursor.insertText(self.history[self.history_idx])
                        except IndexError:
                            self.history_idx += 1
                            cursor.insertText('')
                elif event.key() == QtCore.Qt.Key_Down:
                    # Clear any previous input
                    self._clear_insert_line(cursor)
                    # Get the history
                    if len(self.history) > 0 >= self.history_idx:
                        self.history_idx += 1
                        try:
                            cursor.insertText(self.history[self.history_idx])

# Path: fiddle/config.py
# EDITOR_FONT = 'Consolas'
# 
# EDITOR_FONT_SIZE = 10


# Path: fiddle/controllers/PyConsole.py
import os
import unicodedata
from io import StringIO
from PyQt4 import QtCore, QtGui
from fiddle.config import EDITOR_FONT, EDITOR_FONT_SIZE

                # Get the insert cursor and make sure it's at the end of the console
                cursor = self.textCursor()
                cursor.movePosition(QtGui.QTextCursor.End)
                if self._input_insert_pos < 0:
                    self._input_insert_pos = cursor.position()

                # Scroll view to end of console
                self.setTextCursor(cursor)
                self.ensureCursorVisible()

                # Process the key event
                if event.key() == QtCore.Qt.Key_Up:
                    # Clear any previous input
                    self._clear_insert_line(cursor)
                    # Get the history
                    if len(self.history) > 0:
                        self.history_idx -= 1
                        try:
                            cursor.insertText(self.history[self.history_idx])
                        except IndexError:
                            self.history_idx += 1
                            cursor.insertText('')
                elif event.key() == QtCore.Qt.Key_Down:
                    # Clear any previous input
                    self._clear_insert_line(cursor)
                    # Get the history
                    if len(self.history) > 0 >= self.history_idx:
                        self.history_idx += 1
                        try:
                            cursor.insertText(self.history[self.history_idx])

                        except IndexError: