8000 Add "string" to cppRawDelimiter group name · ChaiScript/vim-cpp@0911af4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0911af4

Browse files
committed
Add "string" to cppRawDelimiter group name
This change fixes handling of raw strings in matchparen - a standard plugin that highlights matching parentheses. The bug that I'm fixing manifests in the following code: foo(bar( R"( )" ) ); If you move over parens in this code in Vim, you'll see that wrong ones are highlighted. This is because matchparen uses syntax highlighting to find (and skip) string literals. To be precise, it assumes that all string literals are highlighted with a syntax group whose name contains "string". Because we used "cppRawDelimiter", which does not contain "string" in it, parens in raw string delimiters confused the matchparen algorithm.
1 parent e56aca6 commit 0911af4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

syntax/cpp.vim

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ if !exists("cpp_no_cpp11")
4646
syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE
4747
syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE
4848
syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE
49-
syn region cppRawString matchgroup=cppRawDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell
49+
syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell
5050
endif
5151

5252
" The minimum and maximum operators in GNU C++
@@ -70,7 +70,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits")
7070
HiLink cppStructure Structure
7171
HiLink cppBoolean Boolean
7272
HiLink cppConstant Constant
73-
HiLink cppRawDelimiter Delimiter
73+
HiLink cppRawStringDelimiter Delimiter
7474
HiLink cppRawString String
7575
delcommand HiLink
7676
endif

0 commit comments

Comments
 (0)
0