diff --git a/nxt_editor/dockwidgets/syntax.py b/nxt_editor/dockwidgets/syntax.py index 6b3eb07..f5e0f59 100644 --- a/nxt_editor/dockwidgets/syntax.py +++ b/nxt_editor/dockwidgets/syntax.py @@ -155,7 +155,7 @@ def match_multiline(self, text, delimiter, in_state, style): match = delimiter.match(text) start = match.capturedStart() # Move past this match - add = match.capturedLength() + add = match.capturedLength() + 1 # As long as there's a delimiter match on this line... while start >= 0: @@ -173,7 +173,10 @@ def match_multiline(self, text, delimiter, in_state, style): # Apply formatting self.setFormat(start, length, style) # Look for the next match - start = match.capturedStart() + (start + length) + match = delimiter.match(text, start + length) + if not match.hasMatch(): + break + start = match.capturedStart() # Return True if still inside a multi-line string, False otherwise if self.currentBlockState() == in_state: