Browse files

make Ctrl-D in qtconsole act same as in terminal

  • Loading branch information...
1 parent 6bc0f53 commit fb8ce6ded7e3f3aaf61dc79c81c8f0ab018837aa @ivanov committed Jan 24, 2012
View
2 IPython/core/usage.py
@@ -413,7 +413,7 @@
- ``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``: EOF - executes current input, 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.
View
9 IPython/frontend/qt/console/console_widget.py
@@ -144,8 +144,7 @@ def _font_family_default(self):
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,12 @@ def _event_filter_console_keypress(self, event):
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)
+ else:
+ self.execute()
+ intercepted = True
#------ Alt modifier ---------------------------------------------------
View
2 IPython/frontend/qt/console/mainwindow.py
@@ -188,6 +188,8 @@ def close_tab(self,current_tab):
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)

0 comments on commit fb8ce6d

Please sign in to comment.