mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 19:36:40 +00:00
fix(chansend): sending lines to terminal in reverse order on Windows #19315
Problem: `chansend()` on Windows sends lines in reverse order. Cause: Using \n instead of \r\n for newlines on Windows. Solution: on Windows, use CRLF newline characters. Fixes #18501
This commit is contained in:

committed by
Justin M. Keyes

parent
9b2c790344
commit
d5004aab27
@@ -7,6 +7,7 @@ local command = helpers.command
|
||||
local pcall_err = helpers.pcall_err
|
||||
local feed = helpers.feed
|
||||
local poke_eventloop = helpers.poke_eventloop
|
||||
local iswin = helpers.iswin
|
||||
|
||||
describe('terminal channel is closed and later released if', function()
|
||||
local screen
|
||||
@@ -92,3 +93,17 @@ describe('terminal channel is closed and later released if', function()
|
||||
eq(chans - 1, eval('len(nvim_list_chans())'))
|
||||
end)
|
||||
end)
|
||||
|
||||
it('chansend sends lines to terminal channel in proper order', function()
|
||||
clear()
|
||||
local screen = Screen.new(100, 20)
|
||||
screen:attach()
|
||||
local shells = iswin() and {'cmd.exe', 'pwsh.exe -nop','powershell.exe -nop'} or {'sh'}
|
||||
for _, sh in ipairs(shells) do
|
||||
command([[bdelete! | let id = termopen(']] .. sh .. [[')]])
|
||||
command([[call chansend(id, ['echo "hello"', 'echo "world"', ''])]])
|
||||
screen:expect{
|
||||
any=[[echo "hello".*echo "world"]]
|
||||
}
|
||||
end
|
||||
end)
|
||||
|
Reference in New Issue
Block a user