Show More
@@ -102,7 +102,8 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||
|
102 | 102 | QtCore.Qt.Key_N : QtCore.Qt.Key_Down, |
|
103 | 103 | QtCore.Qt.Key_D : QtCore.Qt.Key_Delete, } |
|
104 | 104 | _shortcuts = set(_ctrl_down_remap.keys() + |
|
105 |
[ QtCore.Qt.Key_C, QtCore.Qt.Key_ |
|
|
105 | [ QtCore.Qt.Key_C, QtCore.Qt.Key_G, QtCore.Qt.Key_O, | |
|
106 | QtCore.Qt.Key_V ]) | |
|
106 | 107 | |
|
107 | 108 | #--------------------------------------------------------------------------- |
|
108 | 109 | # 'QObject' interface |
@@ -667,20 +668,17 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||
|
667 | 668 | alt_down = event.modifiers() & QtCore.Qt.AltModifier |
|
668 | 669 | shift_down = event.modifiers() & QtCore.Qt.ShiftModifier |
|
669 | 670 | |
|
670 | # Special handling when tab completing in text mode: | |
|
671 | if self._text_completing_pos: | |
|
672 | if key in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return, | |
|
673 | QtCore.Qt.Key_Escape): | |
|
674 | self._clear_temporary_buffer() | |
|
675 | self._text_completing_pos = 0 | |
|
676 | ||
|
677 | 671 | if event.matches(QtGui.QKeySequence.Paste): |
|
678 | 672 | # Call our paste instead of the underlying text widget's. |
|
679 | 673 | self.paste() |
|
680 | 674 | intercepted = True |
|
681 | 675 | |
|
682 | 676 | elif ctrl_down: |
|
683 |
if key == QtCore.Qt.Key_ |
|
|
677 | if key == QtCore.Qt.Key_G: | |
|
678 | self._keyboard_quit() | |
|
679 | intercepted = True | |
|
680 | ||
|
681 | elif key == QtCore.Qt.Key_K: | |
|
684 | 682 | if self._in_buffer(position): |
|
685 | 683 | cursor.movePosition(QtGui.QTextCursor.EndOfLine, |
|
686 | 684 | QtGui.QTextCursor.KeepAnchor) |
@@ -751,6 +749,12 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||
|
751 | 749 | else: |
|
752 | 750 | if key in (QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter): |
|
753 | 751 | intercepted = True |
|
752 | ||
|
753 | # Special handling when tab completing in text mode. | |
|
754 | if self._text_completing_pos: | |
|
755 | self._clear_temporary_buffer() | |
|
756 | self._text_completing_pos = 0 | |
|
757 | ||
|
754 | 758 | if self._in_buffer(position): |
|
755 | 759 | if self._reading: |
|
756 | 760 | self._append_plain_text('\n') |
@@ -763,8 +767,9 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||
|
763 | 767 | elif not self._executing: |
|
764 | 768 | cursor.movePosition(QtGui.QTextCursor.End, |
|
765 | 769 | QtGui.QTextCursor.KeepAnchor) |
|
766 |
|
|
|
767 | self.execute(interactive=True) | |
|
770 | at_end = cursor.selectedText().trimmed().isEmpty() | |
|
771 | if at_end or shift_down: | |
|
772 | self.execute(interactive = not shift_down) | |
|
768 | 773 | else: |
|
769 | 774 | # Do this inside an edit block for clean undo/redo. |
|
770 | 775 | cursor.beginEditBlock() |
@@ -779,6 +784,10 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||
|
779 | 784 | self._control.moveCursor(QtGui.QTextCursor.End) |
|
780 | 785 | self._control.setTextCursor(cursor) |
|
781 | 786 | |
|
787 | elif key == QtCore.Qt.Key_Escape: | |
|
788 | self._keyboard_quit() | |
|
789 | intercepted = True | |
|
790 | ||
|
782 | 791 | elif key == QtCore.Qt.Key_Up: |
|
783 | 792 | if self._reading or not self._up_pressed(): |
|
784 | 793 | intercepted = True |
@@ -1203,6 +1212,15 b' class ConsoleWidget(Configurable, QtGui.QWidget):' | |||
|
1203 | 1212 | cursor.movePosition(QtGui.QTextCursor.End) |
|
1204 | 1213 | self._control.setTextCursor(cursor) |
|
1205 | 1214 | return moved |
|
1215 | ||
|
1216 | def _keyboard_quit(self): | |
|
1217 | """ Cancels the current editing task ala Ctrl-G in Emacs. | |
|
1218 | """ | |
|
1219 | if self._text_completing_pos: | |
|
1220 | self._clear_temporary_buffer() | |
|
1221 | self._text_completing_pos = 0 | |
|
1222 | else: | |
|
1223 | self.input_buffer = '' | |
|
1206 | 1224 | |
|
1207 | 1225 | def _page(self, text): |
|
1208 | 1226 | """ Displays text using the pager if it exceeds the height of the |
General Comments 0
You need to be logged in to leave comments.
Login now