From 45549f031ee52a01601c33acc411f3111cfc4e95 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 1 Jan 2023 03:14:13 +0100 Subject: feat(lua): send "--" literally to Lua "-l" script Problem: When "-l" is followed by "--", we stop sending args to the Lua script and treat "--" in the usual way. This was for flexibility but didn't have a strong use-case, and has these problems: - prevents Lua "-l" scripts from handling "--" in their own way. - complicates the startup logic (must call nlua_init before command_line_scan) Solution: Don't treat "--" specially if it follows "-l". --- test/functional/core/startup_spec.lua | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'test/functional/core/startup_spec.lua') diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 1df8d76c97..dbd517995c 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -107,7 +107,8 @@ describe('startup', function() -- nvim -l foo.lua -arg1 -- a b c assert_l_out([[ bufs: - args: { "-arg1", "--exitcode", "73", "--arg2" }]], + nvim args: 8 + lua args: { "-arg1", "--exitcode", "73", "--arg2" }]], {}, { '-arg1', "--exitcode", "73", '--arg2' } ) @@ -118,7 +119,8 @@ describe('startup', function() -- nvim -l foo.lua -arg1 -- a b c assert_l_out([[ bufs: - args: { "-arg1", "--arg2", "arg3" }]], + nvim args: 7 + lua args: { "-arg1", "--arg2", "arg3" }]], {}, { '-arg1', '--arg2', 'arg3' } ) @@ -127,7 +129,8 @@ describe('startup', function() -- nvim -l foo.lua -- assert_l_out([[ bufs: - args: {}]], + nvim args: 5 + lua args: { "--" }]], {}, { '--' } ) @@ -135,8 +138,9 @@ describe('startup', function() -- nvim file1 file2 -l foo.lua -arg1 -- file3 file4 assert_l_out([[ - bufs: file1 file2 file3 file4 - args: { "-arg1", "arg 2" }]], + bufs: file1 file2 + nvim args: 11 + lua args: { "-arg1", "arg 2", "--", "file3", "file4" }]], { 'file1', 'file2', }, { '-arg1', 'arg 2', '--', 'file3', 'file4' } ) @@ -145,7 +149,8 @@ describe('startup', function() -- nvim file1 file2 -l foo.lua -arg1 -- assert_l_out([[ bufs: file1 file2 - args: { "-arg1" }]], + nvim args: 8 + lua args: { "-arg1", "--" }]], { 'file1', 'file2', }, { '-arg1', '--' } ) @@ -154,7 +159,8 @@ describe('startup', function() -- nvim -l foo.lua assert_l_out([[ bufs: - args: { "-c", "set wrap?" }]], + nvim args: 6 + lua args: { "-c", "set wrap?" }]], {}, { '-c', 'set wrap?' } ) @@ -167,7 +173,8 @@ describe('startup', function() wrap bufs: - args: { "-c", "set wrap?" }]], + nvim args: 8 + lua args: { "-c", "set wrap?" }]], { '-c', 'set wrap?' }, { '-c', 'set wrap?' } ) -- cgit