From 75946deff49f2bd70a8d1180c8e60a88aa056e47 Mon Sep 17 00:00:00 2001 From: xaizek Date: Sun, 5 Nov 2023 15:57:02 +0200 Subject: [PATCH] Fix Python errors on invalid escape sequence \% Looks like it was introduced in Python 3.11. Thanks to Iain Hill (a.k.a. 8i8). Fixes #598. --- plugin/libclang.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/libclang.py b/plugin/libclang.py index 302b3e38..836ceb20 100644 --- a/plugin/libclang.py +++ b/plugin/libclang.py @@ -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) @@ -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)