patch 9.1.1570: Copilot suggested some improvements in cmdexpand.c Commit: https://github.com/vim/vim/commit/88b735973c4c40b1b97620fbf90695944dbde85f Author: John Marriott <basil...@internode.on.net> Date: Sun Jul 20 10:28:26 2025 +0200
patch 9.1.1570: Copilot suggested some improvements in cmdexpand.c Problem: Copilot suggested some improvements in cmdexpand.c (after v9.1.1556) Solution: Use better variable names and comments (John Marriott). closes: #17795 Signed-off-by: John Marriott <basil...@internode.on.net> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/cmdexpand.c b/src/cmdexpand.c index 449636f73..a7a5acf95 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -3718,8 +3718,9 @@ ExpandGenericExt( */ static void expand_shellcmd_onedir( - char_u *pat, - size_t pathlen, // length of the path portion of pat. + char_u *pathed_pattern, // fully pathed pattern + size_t pathlen, // length of the path portion of pathed_pattern + // (0 if no path). char_u ***matches, int *numMatches, int flags, @@ -3727,7 +3728,7 @@ expand_shellcmd_onedir( garray_T *gap) { // Expand matches in one directory of $PATH. - if (expand_wildcards(1, &pat, numMatches, matches, flags) != OK) + if (expand_wildcards(1, &pathed_pattern, numMatches, matches, flags) != OK) return; if (ga_grow(gap, *numMatches) == FAIL) @@ -3878,6 +3879,9 @@ expand_shellcmd( seplen = !after_pathsep(s, e) ? STRLEN_LITERAL(PATHSEPSTR) : 0; } + // Make sure that the pathed pattern (ie the path and pattern concatenated + // together) will fit inside the buffer. If not skip it and move on to the + // next path. if (pathlen + seplen + patlen + 1 <= MAXPATHL) { if (pathlen > 0) diff --git a/src/version.c b/src/version.c index 7297bc8cc..c7027a68e 100644 --- a/src/version.c +++ b/src/version.c @@ -719,6 +719,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1570, /**/ 1569, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1udPfL-00GqLg-IS%40256bit.org.