mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
fix link overflow
The actual regex for Link select the caracter before the bracket if not a start of the line
This commit is contained in:
parent
5c5f08d709
commit
6793aaae36
@ -211,7 +211,8 @@ class MarkdownHighlighter(QSyntaxHighlighter):
|
|||||||
def highlightLink(self, text, cursor, bf, strt):
|
def highlightLink(self, text, cursor, bf, strt):
|
||||||
found = False
|
found = False
|
||||||
for mo in re.finditer(self.MARKDOWN_KEYS_REGEX['Link'],text):
|
for mo in re.finditer(self.MARKDOWN_KEYS_REGEX['Link'],text):
|
||||||
self.setFormat(mo.start()+strt, mo.end() - mo.start()-strt, self.MARKDOWN_KWS_FORMAT['Link'])
|
start_bracket = mo.group()[0][0] == '['
|
||||||
|
self.setFormat(mo.start()+strt+(0 if start_bracket else 1), mo.end() - mo.start()-strt-(0 if start_bracket else 1), self.MARKDOWN_KWS_FORMAT['Link'])
|
||||||
found = True
|
found = True
|
||||||
return found
|
return found
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user