Skip to content

Commit

Permalink
Editor: Use our own copy method for Ctrl+C to avoid Qt copying in HTML
Browse files Browse the repository at this point in the history
Fixes #2285
  • Loading branch information
ccordoba12 committed Jun 13, 2015
1 parent d151091 commit 188d0ca
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spyderlib/widgets/sourcecode/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,17 @@ def toPlainText(self):
else:
return super(TextEditBaseWidget, self).toPlainText()

def keyPressEvent(self, event):
text, key = event.text(), event.key()
ctrl = event.modifiers() & Qt.ControlModifier
meta = event.modifiers() & Qt.MetaModifier
# Use our own copy method for {Ctrl,Cmd}+C to avoid Qt
# copying text in HTML (See Issue 2285)
if (ctrl or meta) and key == Qt.Key_C:
self.copy()
else:
super(TextEditBaseWidget, self).keyPressEvent(event)

#------Text: get, set, ...
def get_selection_as_executable_code(self):
"""Return selected text as a processed text,
Expand Down

0 comments on commit 188d0ca

Please sign in to comment.