commit e52c81f5db901e0dca15a5a65ac0d6eca4efddf6
parent 9b419d0bff8cde24f14c432fd8b1a5f72f6eadc8
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 25 Oct 2021 09:16:19 +0200
syntax: nanorc: improve the file-matching regex
The "\.?" part was pointless. It says that the string "nanorc"
*might* be preceded with a period. Sure, but if the period is
absent, then anything else may be there too, so the optional
period gives zero restriction.
The restriction should be: either the filename has the extension
".nanorc" OR the full filename is "nanorc". So the "nanorc" part
must be preceded by either a period or a slash.
(However, in the times of commits 3dc0e23e and dc9c40a5, fifteen
and eighteen years ago, it was still the user-provided filename
that was matched against the regex, not the full-path filename.
The latter method arrived in commit ec8d51be, six years ago.)
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc
@@ -1,6 +1,6 @@
## Syntax highlighting for nanorc files.
-syntax nanorc "\.?nanorc(\.in)?$"
+syntax nanorc "[/.]nanorc(\.in)?$"
comment "#"
# Everything that does not get recolored is invalid