diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 02:10:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 02:10:59 +0000 |
commit | cccb21df3b4c6fe0aaa99743c418aa973aeebad0 (patch) | |
tree | 35a2d1f88d47e930fec425da1c1cb89b3ccae6e0 /src/vim9script.c | |
parent | Releasing progress-linux version 2:9.1.0199-1~progress7.99u1. (diff) | |
download | vim-cccb21df3b4c6fe0aaa99743c418aa973aeebad0.tar.xz vim-cccb21df3b4c6fe0aaa99743c418aa973aeebad0.zip |
Merging upstream version 2:9.1.0374.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/vim9script.c')
-rw-r--r-- | src/vim9script.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/vim9script.c b/src/vim9script.c index a64ce72..3035889 100644 --- a/src/vim9script.c +++ b/src/vim9script.c @@ -456,15 +456,24 @@ handle_import( scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); char_u *tail = gettail(si->sn_name); char_u *from_name; + int sourced_from_nofile_buf = FALSE; - // Relative to current script: "./name.vim", "../../name.vim". - len = STRLEN(si->sn_name) - STRLEN(tail) + STRLEN(tv.vval.v_string) + 2; - from_name = alloc((int)len); - if (from_name == NULL) - goto erret; - vim_strncpy(from_name, si->sn_name, tail - si->sn_name); - add_pathsep(from_name); - STRCAT(from_name, tv.vval.v_string); + if (STRNCMP(si->sn_name, ":source buffer=", 15) == 0) + sourced_from_nofile_buf = TRUE; + + if (!sourced_from_nofile_buf) + { + // Relative to current script: "./name.vim", "../../name.vim". + len = STRLEN(si->sn_name) - STRLEN(tail) + STRLEN(tv.vval.v_string) + 2; + from_name = alloc((int)len); + if (from_name == NULL) + goto erret; + vim_strncpy(from_name, si->sn_name, tail - si->sn_name); + add_pathsep(from_name); + STRCAT(from_name, tv.vval.v_string); + } + else + from_name = vim_strsave(tv.vval.v_string); simplify_filename(from_name); res = handle_import_fname(from_name, is_autoload, &sid); |