diff --git a/IPython/core/usage.py b/IPython/core/usage.py index 9ccb9df..261cf23 100644 --- a/IPython/core/usage.py +++ b/IPython/core/usage.py @@ -407,13 +407,14 @@ The keybindings themselves are: - ``C-l``: clear terminal. - ``C-a``: go to beginning of line. - ``C-e``: go to end of line. +- ``C-u``: kill from cursor to the begining of the line. - ``C-k``: kill from cursor to the end of the line. - ``C-y``: yank (paste) - ``C-p``: previous line (like up arrow) - ``C-n``: next line (like down arrow) - ``C-f``: forward (like right arrow) - ``C-b``: back (like left arrow) -- ``C-d``: delete next character. +- ``C-d``: delete next character, or exits if input is empty - ``M-<``: move to the beginning of the input region. - ``M->``: move to the end of the input region. - ``M-d``: delete next word. diff --git a/IPython/frontend/qt/console/console_widget.py b/IPython/frontend/qt/console/console_widget.py index bbe94dd..9d06a02 100644 --- a/IPython/frontend/qt/console/console_widget.py +++ b/IPython/frontend/qt/console/console_widget.py @@ -144,8 +144,7 @@ class ConsoleWidget(LoggingConfigurable, QtGui.QWidget): QtCore.Qt.Key_A : QtCore.Qt.Key_Home, QtCore.Qt.Key_P : QtCore.Qt.Key_Up, QtCore.Qt.Key_N : QtCore.Qt.Key_Down, - QtCore.Qt.Key_H : QtCore.Qt.Key_Backspace, - QtCore.Qt.Key_D : QtCore.Qt.Key_Delete, } + QtCore.Qt.Key_H : QtCore.Qt.Key_Backspace, } if not sys.platform == 'darwin': # On OS X, Ctrl-E already does the right thing, whereas End moves the # cursor to the bottom of the buffer. @@ -1115,6 +1114,9 @@ class ConsoleWidget(LoggingConfigurable, QtGui.QWidget): cursor.setPosition(position, QtGui.QTextCursor.KeepAnchor) self._kill_ring.kill_cursor(cursor) intercepted = True + elif key == QtCore.Qt.Key_D: + if len(self.input_buffer) == 0: + self.exit_requested.emit(self) #------ Alt modifier --------------------------------------------------- diff --git a/IPython/frontend/qt/console/mainwindow.py b/IPython/frontend/qt/console/mainwindow.py index 7b622ef..8ee7e64 100644 --- a/IPython/frontend/qt/console/mainwindow.py +++ b/IPython/frontend/qt/console/mainwindow.py @@ -188,6 +188,8 @@ class MainWindow(QtGui.QMainWindow): justthis.setShortcut('N') closeall = QtGui.QPushButton("&Yes, close all", self) closeall.setShortcut('Y') + # allow ctrl-d ctrl-d exit, like in terminal + closeall.setShortcut('Ctrl+D') box = QtGui.QMessageBox(QtGui.QMessageBox.Question, title, msg) box.setInformativeText(info)