diff --git a/src/nvim/message.c b/src/nvim/message.c index cd8a593d1f..088adde7c2 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -2929,7 +2929,7 @@ static void msg_puts_printf(const char *str, const ptrdiff_t maxlen) if (!(silent_mode && p_verbose == 0)) { // NL --> CR NL translation (for Unix, not for "--version") p = &buf[0]; - if (*s == '\n' && !info_message) { + if (*s == '\n' && !info_message && !silent_mode && !headless_mode) { *p++ = '\r'; } memcpy(p, s, (size_t)len); diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 503fe7997d..e317a5d7a5 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -142,6 +142,13 @@ describe('startup', function() end end + it('outputs the EOF as LF (not CRLF) #36853', function() + local args = { nvim_prog, '-l', '-' } + local input = 'print("foo")' + local out = fn.system(args, input) + eq('foo\n', out) + end) + it('failure modes', function() -- nvim -l local proc = n.spawn_wait('-l') @@ -329,7 +336,8 @@ describe('startup', function() '+lua print(("C"):rep(1234))', '+q', }) - eq(('A'):rep(1234) .. '\r\n' .. ('B'):rep(1234) .. '\r\n' .. ('C'):rep(1234), out) + + eq(('A'):rep(1234) .. '\n' .. ('B'):rep(1234) .. '\n' .. ('C'):rep(1234), out) end) it('pipe at both ends: has("ttyin")==0 has("ttyout")==0', function() @@ -494,7 +502,7 @@ describe('startup', function() it('input from pipe + file args #7679', function() eq( - 'ohyeah\r\n0 0 bufs=3', + 'ohyeah\n0 0 bufs=3', fn.system({ nvim_prog, '-n', @@ -515,7 +523,7 @@ describe('startup', function() it('if stdin is empty: selects buffer 2, deletes buffer 1 #8561', function() eq( - '\r\n 2 %a "file1" line 0\r\n 3 "file2" line 0', + '\n 2 %a "file1" line 0\n 3 "file2" line 0', fn.system({ nvim_prog, '-n', @@ -535,7 +543,7 @@ describe('startup', function() it('if stdin is empty and - is last: selects buffer 1, deletes buffer 3 #35269', function() eq( - '\r\n 1 %a "file1" line 0\r\n 2 "file2" line 0', + '\n 1 %a "file1" line 0\n 2 "file2" line 0', fn.system({ nvim_prog, '-n', @@ -755,7 +763,7 @@ describe('startup', function() local expected = '' local period = 100 for i = 1, period - 1 do - expected = expected .. i .. '\r\n' + expected = expected .. i .. '\n' end expected = expected .. period eq( diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua index 6e435c283f..c3fec441a9 100644 --- a/test/functional/plugin/man_spec.lua +++ b/test/functional/plugin/man_spec.lua @@ -253,7 +253,7 @@ describe(':Man', function() matches('^/.+', actual_file) local args = { nvim_prog, '--headless', '+:Man ' .. actual_file, '+q' } matches( - ('Error in command line:\r\n' .. 'man.lua: no manual entry for %s'):format(pesc(actual_file)), + ('Error in command line:\n' .. 'man.lua: no manual entry for %s'):format(pesc(actual_file)), fn.system(args, { '' }) ) os.remove(actual_file)