diff options
author | Mike <Mike325@users.noreply.github.com> | 2023-06-26 11:38:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-26 02:38:48 -0700 |
commit | aa65bd478a9860ff4d2490bb49049c78654e811d (patch) | |
tree | c58601e8274e2cef587730f81718583f7af1ed9e /src | |
parent | b6878f5d6387bad667edf75cf6c70e846c3b0428 (diff) | |
download | rneovim-aa65bd478a9860ff4d2490bb49049c78654e811d.tar.gz rneovim-aa65bd478a9860ff4d2490bb49049c78654e811d.tar.bz2 rneovim-aa65bd478a9860ff4d2490bb49049c78654e811d.zip |
fix(startup): "nvim -l foo.lua" may not set arg0 #24161
Problem:
Using "nvim -l args.lua" without passing extra script args, does not set `_G.arg[0]`.
Steps to reproduce:
```
cat > args.lua<<EOF
vim.print(_G.arg, '')
vim.print(vim.v.argv, '')
EOF
nvim --clean -l args.lua
```
Solution:
Fix condition in command_line_scan.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index 83e56c3066..9b364f8c35 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1361,7 +1361,7 @@ static void command_line_scan(mparm_T *parmp) } parmp->luaf = argv[0]; argc--; - if (argc > 0) { // Lua args after "-l <file>". + if (argc >= 0) { // Lua args after "-l <file>". parmp->lua_arg0 = parmp->argc - argc; argc = 0; } |