Skip to content

Commit

Permalink
Fix Python errors on invalid escape sequence \%
Browse files Browse the repository at this point in the history
Looks like it was introduced in Python 3.11.

Thanks to Iain Hill (a.k.a. 8i8).

Fixes #598.
  • Loading branch information
xaizek committed Nov 5, 2023
1 parent d866f31 commit 75946de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugin/libclang.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ def getQuickFixList(tu):
return [_f for _f in map (getQuickFix, tu.diagnostics) if _f]

def highlightRange(range, hlGroup):
pattern = '/\%' + str(range.start.line) + 'l' + '\%' \
pattern = r'/\%' + str(range.start.line) + 'l' + r'\%' \
+ str(range.start.column) + 'c' + '.*' \
+ '\%' + str(range.end.column) + 'c/'
+ r'\%' + str(range.end.column) + 'c/'
command = "exe 'syntax match' . ' " + hlGroup + ' ' + pattern + "'"
vim.command(command)

Expand All @@ -268,7 +268,7 @@ def highlightDiagnostic(diagnostic):
else:
return

pattern = '/\%' + str(diagnostic.location.line) + 'l\%' \
pattern = r'/\%' + str(diagnostic.location.line) + r'l\%' \
+ str(diagnostic.location.column) + 'c./'
command = "exe 'syntax match' . ' " + hlGroup + ' ' + pattern + "'"
vim.command(command)
Expand Down

0 comments on commit 75946de

Please sign in to comment.