Diff tool: Fix a rare and difficult to trigger error (needs very long lines)

This commit is contained in:
Kovid Goyal 2015-06-26 14:15:45 +05:30
parent 6482a66bb7
commit 4cd3bc037f

View File

@ -39,7 +39,11 @@ class QtHighlighter(QTextDocument):
cursor.insertText(block.text()) cursor.insertText(block.text())
dest_block = cursor.block() dest_block = cursor.block()
c = QTextCursor(dest_block) c = QTextCursor(dest_block)
for af in block.layout().additionalFormats(): try:
afs = block.layout().additionalFormats()
except AttributeError:
afs = ()
for af in afs:
start = dest_block.position() + af.start start = dest_block.position() + af.start
c.setPosition(start), c.setPosition(start + af.length, c.KeepAnchor) c.setPosition(start), c.setPosition(start + af.length, c.KeepAnchor)
c.setCharFormat(af.format) c.setCharFormat(af.format)