Fix gitignore highlighter glob handling

Fixes the handling of multiple backslashes before gitignore * and ?
glob patterns. Adds character classes to gitignore highlighting.

Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>
This commit is contained in:
Adam Christiansen 2022-05-08 11:04:46 -06:00
parent ed99e056b6
commit 70013f5174

View File

@ -53,7 +53,7 @@ add-highlighter shared/git-commit/comments/ regex "\b(?:(modified)|(deleted)|(ne
provide-module git-ignore %{
add-highlighter shared/git-ignore group
add-highlighter shared/git-ignore/glob regex '(?<!\\)\*((?<!\\)\*)?|(?<!\\)\?' 0:operator
+add-highlighter shared/git-ignore/glob regex '(?<!\\)(?:\\\\)*\K(\*\*?|\?|\[.*?(?<!\\)(?:\\\\)*\])' 0:operator
add-highlighter shared/git-ignore/negate regex '^!' 0:operator
add-highlighter shared/git-ignore/comments regex '^#.*?$' 0:comment
}