From e52c81f5db901e0dca15a5a65ac0d6eca4efddf6 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 25 Oct 2021 09:16:19 +0200 Subject: [PATCH] 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.) --- syntax/nanorc.nanorc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc index 3ed173f6..b55979ed 100644 --- 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