# 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
# Copyright (c) 2015 Aaron Kehrer
# Licensed under the terms of the MIT License
# (see fiddle/__init__.py for details)




class PyConsoleTextBrowser(QtGui.QTextBrowser):
    def __init__(self, parent=None, process=None):
        super(PyConsoleTextBrowser, self).__init__(parent)

        self.process = process

        # The start position in the QTextBrowser document where new user input will be inserted
        self._input_insert_pos = -1

        self.history = []
        self.history_idx = 0

        self.setLineWrapMode(QtGui.QTextEdit.NoWrap)
        self.setAcceptRichText(False)
        self.setReadOnly(False)
        self.setOpenExternalLinks(False)
        self.setOpenLinks(False)
        self.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextEditorInteraction)


# 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

# Copyright (c) 2015 Aaron Kehrer
# Licensed under the terms of the MIT License
# (see fiddle/__init__.py for details)




class PyConsoleTextBrowser(QtGui.QTextBrowser):
    def __init__(self, parent=None, process=None):
        super(PyConsoleTextBrowser, self).__init__(parent)

        self.process = process

        # The start position in the QTextBrowser document where new user input will be inserted
        self._input_insert_pos = -1

        self.history = []
        self.history_idx = 0

        self.setLineWrapMode(QtGui.QTextEdit.NoWrap)
        self.setAcceptRichText(False)
        self.setReadOnly(False)
        self.setOpenExternalLinks(False)
        self.setOpenLinks(False)
        self.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextEditorInteraction)


    def keyPressEvent(self, event):