neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 3991f146215ba974fad0ef22beb21e6c95e30138
parent eeacd7bd718af5e6637e8a92a15f308b738a1fea
Author: Brynne Taylor <7542439+brynne8@users.noreply.github.com>
Date:   Tue,  3 Jun 2025 21:36:44 +0800

fix(glob): handling commas in letter pattern #34170


Diffstat:
Mruntime/lua/vim/glob.lua | 4++--
Mtest/functional/lua/glob_spec.lua | 1+
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/runtime/lua/vim/glob.lua b/runtime/lua/vim/glob.lua @@ -44,7 +44,7 @@ local bit = require('bit') local M = {} -- Basic patterns for matching glob components -local letter = m.P(1) - m.S(',*?[]{}/\\') -- Any character except special glob characters +local letter = m.P(1) - m.S('*?[]{}/\\') -- Any character except special glob characters local slash = m.P '/' * m.Cc(m.P '/') -- Path separator with capture local notslash = m.P(1) - m.P '/' -- Any character except path separator local notcomma = m.P(1) - m.S(',\\') -- Any character except comma and backslash @@ -370,7 +370,7 @@ g = m.P(g) ---@return vim.lpeg.Pattern #An |lua-lpeg| representation of the pattern function M.to_lpeg(pattern) local lpeg_pattern = g:match(pattern) --[[@as vim.lpeg.Pattern?]] - assert(lpeg_pattern, 'Invalid glob') + assert(lpeg_pattern, string.format('Invalid glob: %s', pattern)) return lpeg_pattern end diff --git a/test/functional/lua/glob_spec.lua b/test/functional/lua/glob_spec.lua @@ -27,6 +27,7 @@ describe('glob', function() eq(false, match('a', 'b')) eq(false, match('.', 'a')) eq(true, match('$', '$')) + eq(true, match('a,b', 'a,b')) eq(true, match('/dir', '/dir')) eq(true, match('dir/', 'dir/')) eq(true, match('dir/subdir', 'dir/subdir'))