This commit is contained in:
Kovid Goyal 2014-01-18 17:09:30 +05:30
parent d5278bfd5b
commit fff1a25981

View File

@ -87,6 +87,10 @@ class PlainTextEdit(QPlainTextEdit):
self.copy() self.copy()
self.textCursor().removeSelectedText() self.textCursor().removeSelectedText()
@property
def selected_text(self):
return unicodedata.normalize('NFC', unicode(self.textCursor().selectedText()).replace(PARAGRAPH_SEPARATOR, '\n'))
def selection_changed(self): def selection_changed(self):
# Workaround Qt replacing nbsp with normal spaces on copy # Workaround Qt replacing nbsp with normal spaces on copy
clipboard = QApplication.clipboard() clipboard = QApplication.clipboard()
@ -127,10 +131,6 @@ class TextEdit(PlainTextEdit):
self.document().setModified(bool(val)) self.document().setModified(bool(val))
return property(fget=fget, fset=fset) return property(fget=fget, fset=fset)
@property
def selected_text(self):
return unicodedata.normalize('NFC', unicode(self.textCursor().selectedText()).replace(PARAGRAPH_SEPARATOR, '\n'))
def sizeHint(self): def sizeHint(self):
return self.size_hint return self.size_hint