--- a/eric6/QScintilla/Editor.py Sun Dec 06 17:53:05 2020 +0100 +++ b/eric6/QScintilla/Editor.py Sun Dec 06 18:37:08 2020 +0100 @@ -6935,12 +6935,23 @@ """ Protected method to handle the user input a key at a time. - @param ev key event (QKeyEvent) + @param ev key event + @type QKeyEvent """ txt = ev.text() # See it is text to insert. if len(txt) and txt >= " ": + if txt in ('"', "'") and self.hasSelectedText(): + sline, sindex, eline, eindex = self.getSelection() + replaceText = txt + self.selectedText() + txt + self.beginUndoAction() + self.replaceSelectedText(replaceText) + self.endUndoAction() + self.setSelection(sline, sindex + 1, eline, eindex + 1) + ev.accept() + return + super(Editor, self).keyPressEvent(ev) else: ev.ignore() @@ -6954,7 +6965,8 @@ assuming, that it is in the vicinity of the old position after the reread. - @param event the event object (QFocusEvent) + @param event the event object + @type QFocusEvent """ self.recolor() self.vm.editActGrp.setEnabled(True) @@ -7007,7 +7019,8 @@ """ Protected method called when the editor loses focus. - @param event the event object (QFocusEvent) + @param event the event object + @type QFocusEvent """ self.vm.editorActGrp.setEnabled(False) self.setCaretWidth(0) @@ -7024,7 +7037,8 @@ other modes. This is to make the editor windows work nicer with the QWorkspace. - @param evt the event, that was generated (QEvent) + @param evt the event, that was generated + @type QEvent """ if ( evt.type() == QEvent.WindowStateChange and @@ -7044,7 +7058,8 @@ """ Protected method to handle the mouse press event. - @param event the mouse press event (QMouseEvent) + @param event the mouse press event + @type QMouseEvent """ self.vm.eventFilter(self, event) super(Editor, self).mousePressEvent(event) @@ -7053,7 +7068,8 @@ """ Protected method to handle wheel events. - @param evt reference to the wheel event (QWheelEvent) + @param evt reference to the wheel event + @type QWheelEvent """ delta = evt.angleDelta().y() if evt.modifiers() & Qt.ControlModifier: @@ -7078,8 +7094,10 @@ """ Public method handling events. - @param evt reference to the event (QEvent) - @return flag indicating, if the event was handled (boolean) + @param evt reference to the event + @type QEvent + @return flag indicating, if the event was handled + @rtype bool """ if evt.type() == QEvent.Gesture: self.gestureEvent(evt) @@ -7091,7 +7109,8 @@ """ Protected method handling gesture events. - @param evt reference to the gesture event (QGestureEvent + @param evt reference to the gesture event + @type QGestureEvent """ pinch = evt.gesture(Qt.PinchGesture) if pinch: @@ -7113,7 +7132,8 @@ """ Protected method handling resize events. - @param evt reference to the resize event (QResizeEvent) + @param evt reference to the resize event + @type QResizeEvent """ super(Editor, self).resizeEvent(evt) self.__markerMap.calculateGeometry() @@ -7122,8 +7142,10 @@ """ Protected method handling event of the viewport. - @param evt reference to the event (QEvent) - @return flag indiating that the event was handled (boolean) + @param evt reference to the event + @type QEvent + @return flag indiating that the event was handled + @rtype bool """ try: self.__markerMap.calculateGeometry()