From 9c2099d5850a6a434f7269913d316d57da1362e2 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 4 Jun 2018 02:06:32 +0200 Subject: Ex mode: use getexline() instead of getexmodeline() This changes Ex mode (Q, -e) to work like Vim's "improved Ex mode" (gQ, -E). That brings some small behavior differences, but should not impact most Ex scripts (unless, for example, they depend on mappings being disabled--but that can be solved for -e by skipping user config). Before this change: * the screen test hangs. After this change: * Q acts like gQ. * -e/-es differs from -E/-Es only in its treatment of stdin. This moves towards potentially removing getexmodeline(). (HINT: That does NOT mean "removing Ex mode", it means removing the Vi-compatible Ex mode, which differs from Vim's "improved Ex mode" only in some minor details (e.g. mappings are disabled).) ref #1089 :-)~ --- test/functional/core/startup_spec.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index f323056179..c20ac668c4 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -123,9 +123,19 @@ describe('startup', function() end) it('-e/-E interactive #7679', function() - clear('-E') + clear('-e') local screen = Screen.new(25, 3) screen:attach() + feed("put ='from -e'") + screen:expect([[ + :put ='from -e' | + from -e | + :^ | + ]]) + + clear('-E') + screen = Screen.new(25, 3) + screen:attach() feed("put ='from -E'") screen:expect([[ :put ='from -E' | -- cgit From 487cf98c0b61ade023fc71d945a64e61f8374eac Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 17 Jun 2018 14:22:02 +0200 Subject: startup: fix -E/-Es without `-u NONE` Before this change, -E/-Es without `-u NONE` reads stdin as Ex commands. It should always read stdin as text (into buffer 1), like this: echo foo | nvim -Es +'%p' foo echo foo | nvim -Es -u NORC +'%p' foo --- test/functional/core/startup_spec.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index c20ac668c4..ae5e2b4115 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -157,6 +157,14 @@ describe('startup', function() eq(inputstr, funcs.system({nvim_prog, '-i', 'NONE', '-Es', '+%print', '-' }, input)) + -- with `-u NORC` + eq('thepartycontinues\n', + funcs.system({nvim_prog, '-n', '-u', 'NORC', '-Es', '+.print' }, + { 'thepartycontinues', '' })) + -- without `-u` + eq('thepartycontinues\n', + funcs.system({nvim_prog, '-n', '-Es', '+.print' }, + { 'thepartycontinues', '' })) -- -- -es: read stdin as ex-commands @@ -167,6 +175,14 @@ describe('startup', function() eq('line1\nline2\n', funcs.system({nvim_prog, '-i', 'NONE', '-es', '-' }, input)) + -- with `-u NORC` + eq(' encoding=utf-8\n', + funcs.system({nvim_prog, '-n', '-u', 'NORC', '-es' }, + { 'set encoding', '' })) + -- without `-u` + eq(' encoding=utf-8\n', + funcs.system({nvim_prog, '-n', '-es' }, + { 'set encoding', '' })) end) end) -- cgit