##// END OF EJS Templates
fix Ctrl+G/esc intercepted bug
Matthias BUSSONNIER -
Show More
@@ -171,7 +171,7 b' class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):'
171 [ QtCore.Qt.Key_C, QtCore.Qt.Key_G, QtCore.Qt.Key_O,
171 [ QtCore.Qt.Key_C, QtCore.Qt.Key_G, QtCore.Qt.Key_O,
172 QtCore.Qt.Key_V ])
172 QtCore.Qt.Key_V ])
173
173
174 _is_completing = False
174 _temp_buffer_filled = False
175
175
176 #---------------------------------------------------------------------------
176 #---------------------------------------------------------------------------
177 # 'QObject' interface
177 # 'QObject' interface
@@ -850,6 +850,7 b' class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):'
850 the prompt region.
850 the prompt region.
851 """
851 """
852 # Select and remove all text below the input buffer.
852 # Select and remove all text below the input buffer.
853 _temp_buffer_filled = False
853 cursor = self._get_prompt_cursor()
854 cursor = self._get_prompt_cursor()
854 prompt = self._continuation_prompt.lstrip()
855 prompt = self._continuation_prompt.lstrip()
855 while cursor.movePosition(QtGui.QTextCursor.NextBlock):
856 while cursor.movePosition(QtGui.QTextCursor.NextBlock):
@@ -894,7 +895,6 b' class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):'
894
895
895 cursor.movePosition(QtGui.QTextCursor.Left, n=len(prefix))
896 cursor.movePosition(QtGui.QTextCursor.Left, n=len(prefix))
896 self._completion_widget.show_items(cursor, items)
897 self._completion_widget.show_items(cursor, items)
897 self._is_completing = True
898
898
899
899
900 def _fill_temporary_buffer(self, cursor, text, html=False):
900 def _fill_temporary_buffer(self, cursor, text, html=False):
@@ -911,6 +911,8 b' class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):'
911 self._control.moveCursor(QtGui.QTextCursor.End)
911 self._control.moveCursor(QtGui.QTextCursor.End)
912 self._control.setTextCursor(cursor)
912 self._control.setTextCursor(cursor)
913
913
914 _temp_buffer_filled = True
915
914
916
915 def _context_menu_make(self, pos):
917 def _context_menu_make(self, pos):
916 """ Creates a context menu for the given QPoint (in widget coordinates).
918 """ Creates a context menu for the given QPoint (in widget coordinates).
@@ -1654,8 +1656,9 b' class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):'
1654 def _keyboard_quit(self):
1656 def _keyboard_quit(self):
1655 """ Cancels the current editing task ala Ctrl-G in Emacs.
1657 """ Cancels the current editing task ala Ctrl-G in Emacs.
1656 """
1658 """
1657 if self._is_completing:
1659 if self._temp_buffer_filled :
1658 self._cancel_completion()
1660 self._cancel_completion()
1661 self._clear_temporary_buffer()
1659 else:
1662 else:
1660 self.input_buffer = ''
1663 self.input_buffer = ''
1661
1664
General Comments 0
You need to be logged in to leave comments. Login now