mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 17:36:29 +00:00
Merge pull request #26456 from gpanders/ignore-vim-runtime
fix(terminal): ignore $VIM and $VIMRUNTIME in pty jobs
This commit is contained in:
@@ -3903,6 +3903,8 @@ static const char *pty_ignored_env_vars[] = {
|
|||||||
"COLORFGBG",
|
"COLORFGBG",
|
||||||
"COLORTERM",
|
"COLORTERM",
|
||||||
#endif
|
#endif
|
||||||
|
"VIM",
|
||||||
|
"VIMRUNTIME",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -866,7 +866,11 @@ describe('user config init', function()
|
|||||||
|
|
||||||
local screen = Screen.new(50, 8)
|
local screen = Screen.new(50, 8)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
funcs.termopen({nvim_prog})
|
funcs.termopen({nvim_prog}, {
|
||||||
|
env = {
|
||||||
|
VIMRUNTIME = os.getenv('VIMRUNTIME'),
|
||||||
|
},
|
||||||
|
})
|
||||||
screen:expect({ any = pesc('[i]gnore, (v)iew, (d)eny, (a)llow:') })
|
screen:expect({ any = pesc('[i]gnore, (v)iew, (d)eny, (a)llow:') })
|
||||||
-- `i` to enter Terminal mode, `a` to allow
|
-- `i` to enter Terminal mode, `a` to allow
|
||||||
feed('ia')
|
feed('ia')
|
||||||
|
@@ -127,7 +127,13 @@ end
|
|||||||
local function setup_child_nvim(args, opts)
|
local function setup_child_nvim(args, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
local argv = { nvim_prog, unpack(args) }
|
local argv = { nvim_prog, unpack(args) }
|
||||||
return screen_setup(0, argv, opts.cols, opts.env)
|
|
||||||
|
local env = opts.env or {}
|
||||||
|
if not env.VIMRUNTIME then
|
||||||
|
env.VIMRUNTIME = os.getenv('VIMRUNTIME')
|
||||||
|
end
|
||||||
|
|
||||||
|
return screen_setup(0, argv, opts.cols, env)
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@@ -147,6 +147,10 @@ it(':terminal highlight has lower precedence than editor #9964', function()
|
|||||||
'+hi Normal ctermfg=Blue ctermbg=Yellow',
|
'+hi Normal ctermfg=Blue ctermbg=Yellow',
|
||||||
'+norm! ichild nvim',
|
'+norm! ichild nvim',
|
||||||
'+norm! oline 2',
|
'+norm! oline 2',
|
||||||
|
}, {
|
||||||
|
env = {
|
||||||
|
VIMRUNTIME = os.getenv('VIMRUNTIME'),
|
||||||
|
},
|
||||||
})
|
})
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{N_child:^child nvim }|
|
{N_child:^child nvim }|
|
||||||
|
@@ -24,6 +24,7 @@ local funcs = helpers.funcs
|
|||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local is_ci = helpers.is_ci
|
local is_ci = helpers.is_ci
|
||||||
local is_os = helpers.is_os
|
local is_os = helpers.is_os
|
||||||
|
local is_arch = helpers.is_arch
|
||||||
local new_pipename = helpers.new_pipename
|
local new_pipename = helpers.new_pipename
|
||||||
local spawn_argv = helpers.spawn_argv
|
local spawn_argv = helpers.spawn_argv
|
||||||
local set_session = helpers.set_session
|
local set_session = helpers.set_session
|
||||||
@@ -1829,8 +1830,18 @@ describe('TUI', function()
|
|||||||
[5] = {bold = true, reverse = true},
|
[5] = {bold = true, reverse = true},
|
||||||
})
|
})
|
||||||
screen:attach()
|
screen:attach()
|
||||||
|
funcs.termopen({
|
||||||
|
nvim_prog,
|
||||||
|
'--clean',
|
||||||
|
'--cmd', 'colorscheme vim',
|
||||||
|
'--cmd', 'set notermguicolors',
|
||||||
|
'--cmd', 'let start = reltime() | while v:true | if reltimefloat(reltime(start)) > 2 | break | endif | endwhile',
|
||||||
|
}, {
|
||||||
|
env = {
|
||||||
|
VIMRUNTIME = os.getenv('VIMRUNTIME'),
|
||||||
|
},
|
||||||
|
})
|
||||||
exec([[
|
exec([[
|
||||||
call termopen([v:progpath, '--clean', '--cmd', 'set notermguicolors', '--cmd', 'colorscheme vim', '--cmd', 'let start = reltime() | while v:true | if reltimefloat(reltime(start)) > 2 | break | endif | endwhile'])
|
|
||||||
sleep 500m
|
sleep 500m
|
||||||
vs new
|
vs new
|
||||||
]])
|
]])
|
||||||
@@ -1849,6 +1860,9 @@ describe('TUI', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('argv[0] can be overridden #23953', function()
|
it('argv[0] can be overridden #23953', function()
|
||||||
|
if is_arch('aarch64') then
|
||||||
|
pending('execl does not work on aarch64')
|
||||||
|
end
|
||||||
if not exec_lua('return pcall(require, "ffi")') then
|
if not exec_lua('return pcall(require, "ffi")') then
|
||||||
pending('missing LuaJIT FFI')
|
pending('missing LuaJIT FFI')
|
||||||
end
|
end
|
||||||
@@ -1887,8 +1901,12 @@ describe('TUI', function()
|
|||||||
finally(function()
|
finally(function()
|
||||||
os.remove('testF')
|
os.remove('testF')
|
||||||
end)
|
end)
|
||||||
local screen = thelpers.screen_setup(0, nvim_prog
|
local screen = thelpers.screen_setup(0,
|
||||||
..' -u NONE -i NONE --cmd \'set noswapfile noshowcmd noruler\' --cmd \'normal iabc\' > /dev/null 2>&1 && cat testF && rm testF')
|
string.format(
|
||||||
|
'VIMRUNTIME=%s %s -u NONE -i NONE --cmd \'set noswapfile noshowcmd noruler\' --cmd \'normal iabc\' > /dev/null 2>&1 && cat testF && rm testF',
|
||||||
|
os.getenv('VIMRUNTIME'),
|
||||||
|
nvim_prog
|
||||||
|
))
|
||||||
feed_data(':w testF\n:q\n')
|
feed_data(':w testF\n:q\n')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
:w testF |
|
:w testF |
|
||||||
|
@@ -376,6 +376,19 @@ function module.is_os(s)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function module.is_arch(s)
|
||||||
|
local machine = luv.os_uname().machine
|
||||||
|
if s == 'arm64' or s == 'aarch64' then
|
||||||
|
return machine == 'arm64' or machine == 'aarch64'
|
||||||
|
end
|
||||||
|
|
||||||
|
if s == 'x86' or s == 'x86_64' or s == 'amd64' then
|
||||||
|
return machine == 'x86_64'
|
||||||
|
end
|
||||||
|
|
||||||
|
return machine == s
|
||||||
|
end
|
||||||
|
|
||||||
local function tmpdir_get()
|
local function tmpdir_get()
|
||||||
return os.getenv('TMPDIR') and os.getenv('TMPDIR') or os.getenv('TEMP')
|
return os.getenv('TMPDIR') and os.getenv('TMPDIR') or os.getenv('TEMP')
|
||||||
end
|
end
|
||||||
|
@@ -7,6 +7,8 @@ function s:logger.on_exit(id, data, event)
|
|||||||
call add(self.d_events, [a:event, ['']])
|
call add(self.d_events, [a:event, ['']])
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let s:logger.env = #{VIMRUNTIME: $VIMRUNTIME}
|
||||||
|
|
||||||
" Replace non-printable chars by special sequence, or "<%x>".
|
" Replace non-printable chars by special sequence, or "<%x>".
|
||||||
let s:escaped_char = {"\n": '\n', "\r": '\r', "\t": '\t'}
|
let s:escaped_char = {"\n": '\n', "\r": '\r', "\t": '\t'}
|
||||||
function! s:escape_non_printable(char) abort
|
function! s:escape_non_printable(char) abort
|
||||||
|
Reference in New Issue
Block a user