From 4c4f74fb5d3849affa04177c9cc79e9fbf9c971b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 10 Apr 2015 20:52:02 +0530 Subject: [PATCH] Edit Book: Fix regression that caused copying of non-breaking spaces to not work when using the keyboard shortcuts --- src/calibre/gui2/tweak_book/editor/text.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/calibre/gui2/tweak_book/editor/text.py b/src/calibre/gui2/tweak_book/editor/text.py index 7f1129e5bc..41ead63caa 100644 --- a/src/calibre/gui2/tweak_book/editor/text.py +++ b/src/calibre/gui2/tweak_book/editor/text.py @@ -533,17 +533,16 @@ class TextEdit(PlainTextEdit): self.show_tooltip(ev) return True if ev.type() == ev.ShortcutOverride: - if ev in ( - # Let the global cut/copy/paste/undo/redo shortcuts work,this avoids the nbsp - # problem as well, since they use the overridden copy() method - # instead of the one from Qt, and allows proper customization - # of the shortcuts - QKeySequence.Copy, QKeySequence.Cut, QKeySequence.Paste, QKeySequence.Undo, QKeySequence.Redo - ) or ( - # This is used to convert typed hex codes into unicode - # characters - ev.key() == Qt.Key_X and ev.modifiers() == Qt.AltModifier - ): + # Let the global cut/copy/paste/undo/redo shortcuts work, this avoids the nbsp + # problem as well, since they use the overridden copy() method + # instead of the one from Qt, and allows proper customization + # of the shortcuts + if ev in (QKeySequence.Copy, QKeySequence.Cut, QKeySequence.Paste, QKeySequence.Undo, QKeySequence.Redo): + ev.ignore() + return True + # This is used to convert typed hex codes into unicode + # characters + if ev.key() == Qt.Key_X and ev.modifiers() == Qt.AltModifier: ev.accept() return True return QPlainTextEdit.event(self, ev)