More stupid PyQt enums

This commit is contained in:
Kovid Goyal 2020-12-20 11:51:57 +05:30
parent 98d34f057a
commit 3cba0dcec8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -3,7 +3,7 @@
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
from PyQt5.Qt import QTextCursor
from PyQt5.Qt import QTextCursor, QTextDocument
opening_map = {
'css':'/*',
@ -24,10 +24,10 @@ def apply_smart_comment(editor, opening='/*', closing='*/', line_comment=None):
doc = editor.document()
c = QTextCursor(editor.textCursor())
c.clearSelection()
before_opening = doc.find(opening, c, doc.FindBackward | doc.FindCaseSensitively)
before_closing = doc.find(closing, c, doc.FindBackward | doc.FindCaseSensitively)
after_opening = doc.find(opening, c, doc.FindCaseSensitively)
after_closing = doc.find(closing, c, doc.FindCaseSensitively)
before_opening = doc.find(opening, c, QTextDocument.FindFlag.FindBackward | QTextDocument.FindFlag.FindCaseSensitively)
before_closing = doc.find(closing, c, QTextDocument.FindFlag.FindBackward | QTextDocument.FindFlag.FindCaseSensitively)
after_opening = doc.find(opening, c, QTextDocument.FindFlag.FindCaseSensitively)
after_closing = doc.find(closing, c, QTextDocument.FindFlag.FindCaseSensitively)
in_block_comment = (not before_opening.isNull() and (before_closing.isNull() or before_opening.position() >= before_closing.position())) and \
(not after_closing.isNull() and (after_opening.isNull() or after_closing.position() <= after_opening.position()))
if in_block_comment: