From b1a7241a7dd8bdab604a5632cc445ef890ae5ab5 2010-08-03 17:11:30
From: epatters <epatters@enthought.com>
Date: 2010-08-03 17:11:30
Subject: [PATCH] * Fixed history breakage due to recent refactoring.
* Minor documentation and cleanup.

---

diff --git a/IPython/frontend/qt/console/console_widget.py b/IPython/frontend/qt/console/console_widget.py
index 2755c70..12d5a62 100644
--- a/IPython/frontend/qt/console/console_widget.py
+++ b/IPython/frontend/qt/console/console_widget.py
@@ -406,6 +406,12 @@ class ConsoleWidget(QtGui.QPlainTextEdit):
             entered by the user. The effect of this parameter depends on the
             subclass implementation.
 
+        Raises:
+        -------
+        RuntimeError
+            If incomplete input is given and 'hidden' is True. In this case,
+            it not possible to prompt for more input.
+
         Returns:
         --------
         A boolean indicating whether the source was executed.
@@ -751,14 +757,14 @@ class HistoryConsoleWidget(ConsoleWidget):
     def execute(self, source=None, hidden=False, interactive=False):
         """ Reimplemented to the store history.
         """
-        if source is None and not hidden:
-            history = self.input_buffer.rstrip()
+        if not hidden:
+            history = self.input_buffer if source is None else source
 
         executed = super(HistoryConsoleWidget, self).execute(
             source, hidden, interactive)
 
         if executed and not hidden:
-            self._history.append(history)
+            self._history.append(history.rstrip())
             self._history_index = len(self._history)
 
         return executed
diff --git a/IPython/frontend/qt/console/ipython_widget.py b/IPython/frontend/qt/console/ipython_widget.py
index 38d85a6..d389451 100644
--- a/IPython/frontend/qt/console/ipython_widget.py
+++ b/IPython/frontend/qt/console/ipython_widget.py
@@ -103,5 +103,3 @@ if __name__ == '__main__':
     widget.resize(640, 480)
     widget.show()
     app.exec_()
-
-