From 0768da5adb59bcadaed2a34d44a124925045d6d7 2010-08-26 14:26:58
From: epatters <epatters@enthought.com>
Date: 2010-08-26 14:26:58
Subject: [PATCH] * Added support for Ctrl-L per Fernando's request.
* Fixed history storing empty commands.
* Fixed long lines in ipythonqt

---

diff --git a/IPython/frontend/qt/console/console_widget.py b/IPython/frontend/qt/console/console_widget.py
index cc7e0d2..8b0dc0d 100644
--- a/IPython/frontend/qt/console/console_widget.py
+++ b/IPython/frontend/qt/console/console_widget.py
@@ -629,7 +629,13 @@ class ConsoleWidget(QtGui.QWidget):
                     cursor.removeSelectedText()
                 intercepted = True
 
+            elif key == QtCore.Qt.Key_L:
+                self.clear()
+                intercepted = True
+
             elif key == QtCore.Qt.Key_X:
+                # FIXME: Instead of disabling cut completely, only allow it
+                # when safe.
                 intercepted = True
 
             elif key == QtCore.Qt.Key_Y:
@@ -1285,8 +1291,11 @@ class HistoryConsoleWidget(ConsoleWidget):
             source, hidden, interactive)
 
         if executed and not hidden:
-            self._history.append(history.rstrip())
-            self._history_index = len(self._history)
+            # Save the command unless it was a blank line.
+            history = history.rstrip()
+            if history:
+                self._history.append(history)
+                self._history_index = len(self._history)
 
         return executed
 
diff --git a/IPython/frontend/qt/console/scripts/ipythonqt.py b/IPython/frontend/qt/console/scripts/ipythonqt.py
index cbc6fd5..4123cb4 100755
--- a/IPython/frontend/qt/console/scripts/ipythonqt.py
+++ b/IPython/frontend/qt/console/scripts/ipythonqt.py
@@ -39,9 +39,9 @@ def main():
                         'use a pure Python kernel instead of an IPython kernel')
     egroup.add_argument('--pylab', type=str, metavar='GUI', nargs='?', 
                        const='auto', help = \
-                       "Pre-load matplotlib and numpy for interactive use. If GUI is not \
-                       given, the GUI backend is matplotlib's, otherwise use one of: \
-                       ['tk', 'gtk', 'qt', 'wx', 'payload-svg'].")
+        "Pre-load matplotlib and numpy for interactive use. If GUI is not \
+         given, the GUI backend is matplotlib's, otherwise use one of: \
+         ['tk', 'gtk', 'qt', 'wx', 'payload-svg'].")
 
     wgroup = parser.add_argument_group('widget options')
     wgroup.add_argument('--paging', type=str, default='inside',