Skip to content

Commit

Permalink
#35
Browse files Browse the repository at this point in the history
fixs the issue of formatting in tag views.
  • Loading branch information
Casey committed Oct 6, 2020
1 parent 67b00df commit 85fbe27
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions widgets/Highlighter.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,21 @@ def highlightBlock(self, text):
if self.editor.viewManager.isTagView():
# format text string
textLen = len(token.text)
textStart = (token.start - currentBlock.position())
if token.start == 0:
textStart = (token.start - currentBlock.position())
else:
textStart = tagStart + tagSpan + 1
textSpan = textLen
if token.level in highlightedLevels:
self.setFormat(textStart, textSpan, format)

# format tags
tagFormat = self.editor.formatManager.TAG_FORMAT
tagStart = (
token.start - currentBlock.position()) + textLen
tagSpan = token.length - textLen
# tagStart = (
# token.start - currentBlock.position()) + textLen
tagStart = textStart + textSpan + 1
# tagSpan = token.length - textLen
tagSpan = 1 + len(token.pos)
self.setFormat(tagStart, tagSpan, tagFormat)

else: # 可輸入文字的 View
Expand Down

0 comments on commit 85fbe27

Please sign in to comment.