mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
fix(runtime): fix missing packpath entries
This commit is contained in:
@@ -439,16 +439,16 @@ static void expand_rtp_entry(RuntimeSearchPath *search_path, Map(String, handle_
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void expand_pack_entry(RuntimeSearchPath *search_path, Map(String, handle_T) *rtp_used,
|
static void expand_pack_entry(RuntimeSearchPath *search_path, Map(String, handle_T) *rtp_used,
|
||||||
CharVec *after_path, char_u *pack_entry)
|
CharVec *after_path, char_u *pack_entry, size_t pack_entry_len)
|
||||||
{
|
{
|
||||||
static char buf[MAXPATHL];
|
static char buf[MAXPATHL];
|
||||||
char *(start_pat[]) = { "/pack/*/start/*", "/start/*" }; // NOLINT
|
char *(start_pat[]) = { "/pack/*/start/*", "/start/*" }; // NOLINT
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (STRLEN(pack_entry) + STRLEN(start_pat[i]) + 1 > MAXPATHL) {
|
if (pack_entry_len + STRLEN(start_pat[i]) + 1 > sizeof buf) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
STRLCPY(buf, pack_entry, MAXPATHL);
|
STRLCPY(buf, pack_entry, sizeof buf);
|
||||||
xstrlcat(buf, start_pat[i], sizeof buf);
|
STRLCPY(buf + pack_entry_len, start_pat[i], sizeof buf - pack_entry_len);
|
||||||
expand_rtp_entry(search_path, rtp_used, buf, false);
|
expand_rtp_entry(search_path, rtp_used, buf, false);
|
||||||
size_t after_size = STRLEN(buf)+7;
|
size_t after_size = STRLEN(buf)+7;
|
||||||
char *after = xmallocz(after_size);
|
char *after = xmallocz(after_size);
|
||||||
@@ -507,14 +507,15 @@ RuntimeSearchPath runtime_search_path_build(void)
|
|||||||
handle_T *h = map_ref(String, handle_T)(&pack_used, cstr_as_string((char *)buf), false);
|
handle_T *h = map_ref(String, handle_T)(&pack_used, cstr_as_string((char *)buf), false);
|
||||||
if (h) {
|
if (h) {
|
||||||
(*h)++;
|
(*h)++;
|
||||||
expand_pack_entry(&search_path, &rtp_used, &after_path, buf);
|
expand_pack_entry(&search_path, &rtp_used, &after_path, buf, buflen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < kv_size(pack_entries); i++) {
|
for (size_t i = 0; i < kv_size(pack_entries); i++) {
|
||||||
handle_T h = map_get(String, handle_T)(&pack_used, kv_A(pack_entries, i));
|
String item = kv_A(pack_entries, i);
|
||||||
|
handle_T h = map_get(String, handle_T)(&pack_used, item);
|
||||||
if (h == 0) {
|
if (h == 0) {
|
||||||
expand_pack_entry(&search_path, &rtp_used, &after_path, (char_u *)kv_A(pack_entries, i).data);
|
expand_pack_entry(&search_path, &rtp_used, &after_path, (char_u *)item.data, item.size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -414,6 +414,11 @@ describe('startup', function()
|
|||||||
eq({'ordinary', 'funky!', 'FANCY', 'mittel', 'FANCY after', 'ordinary after'}, exec_lua [[ return _G.test_loadorder ]])
|
eq({'ordinary', 'funky!', 'FANCY', 'mittel', 'FANCY after', 'ordinary after'}, exec_lua [[ return _G.test_loadorder ]])
|
||||||
eq({'ordinary', 'funky!', 'mittel', 'ordinary after'}, exec_lua [[ return _G.nested_order ]])
|
eq({'ordinary', 'funky!', 'mittel', 'ordinary after'}, exec_lua [[ return _G.nested_order ]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("handles the correct order when prepending packpath", function()
|
||||||
|
clear{args={'--cmd', 'set packpath^=test/functional/fixtures', '--cmd', [[ lua _G.test_loadorder = {} vim.cmd "runtime! filen.lua" ]]}, env={XDG_CONFIG_HOME='test/functional/fixtures/'}}
|
||||||
|
eq({'ordinary', 'FANCY', 'FANCY after', 'ordinary after'}, exec_lua [[ return _G.test_loadorder ]])
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('sysinit', function()
|
describe('sysinit', function()
|
||||||
|
Reference in New Issue
Block a user