mirror of
https://github.com/neovim/neovim.git
synced 2025-12-14 18:35:47 +00:00
doc: Fix some typos and trailing whitespace. #2875
This commit is contained in:
committed by
Justin M. Keyes
parent
9ebb5c681b
commit
7e7d78b2a6
@@ -32,7 +32,7 @@ available shells, instead relying on OS functionality for process management.
|
|||||||
|
|
||||||
Internally, Nvim job control is powered by libuv, which has a nice
|
Internally, Nvim job control is powered by libuv, which has a nice
|
||||||
cross-platform API for managing processes. See https://github.com/libuv/libuv
|
cross-platform API for managing processes. See https://github.com/libuv/libuv
|
||||||
for details
|
for details.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
2. Usage *job-control-usage*
|
2. Usage *job-control-usage*
|
||||||
@@ -76,7 +76,7 @@ Here's what is happening:
|
|||||||
- The `JobHandler()` function is a callback passed to |jobstart()| to handle
|
- The `JobHandler()` function is a callback passed to |jobstart()| to handle
|
||||||
various job events. It takes care of displaying stdout/stderr received from
|
various job events. It takes care of displaying stdout/stderr received from
|
||||||
the shells.
|
the shells.
|
||||||
- The arguments passed to `JobHandler()` are:
|
- The arguments passed to `JobHandler()` are:
|
||||||
|
|
||||||
0: The job id
|
0: The job id
|
||||||
1: If the event is "stdout" or "stderr", a list with lines read from the
|
1: If the event is "stdout" or "stderr", a list with lines read from the
|
||||||
@@ -88,23 +88,23 @@ The options dictionary is passed as the "self" variable to the callback
|
|||||||
function. Here's a more object-oriented version of the above:
|
function. Here's a more object-oriented version of the above:
|
||||||
>
|
>
|
||||||
let Shell = {}
|
let Shell = {}
|
||||||
|
|
||||||
function Shell.on_stdout(job_id, data)
|
function Shell.on_stdout(job_id, data)
|
||||||
call append(line('$'), self.get_name().' stdout: '.join(a:data))
|
call append(line('$'), self.get_name().' stdout: '.join(a:data))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function Shell.on_stderr(job_id, data)
|
function Shell.on_stderr(job_id, data)
|
||||||
call append(line('$'), self.get_name().' stderr: '.join(a:data))
|
call append(line('$'), self.get_name().' stderr: '.join(a:data))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function Shell.on_exit(job_id, data)
|
function Shell.on_exit(job_id, data)
|
||||||
call append(line('$'), self.get_name().' exited')
|
call append(line('$'), self.get_name().' exited')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function Shell.get_name()
|
function Shell.get_name()
|
||||||
return 'shell '.self.name
|
return 'shell '.self.name
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function Shell.new(name, ...)
|
function Shell.new(name, ...)
|
||||||
let instance = extend(copy(g:Shell), {'name': a:name})
|
let instance = extend(copy(g:Shell), {'name': a:name})
|
||||||
let argv = ['bash']
|
let argv = ['bash']
|
||||||
@@ -114,7 +114,7 @@ function. Here's a more object-oriented version of the above:
|
|||||||
let instance.id = jobstart(argv, instance)
|
let instance.id = jobstart(argv, instance)
|
||||||
return instance
|
return instance
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s1 = Shell.new('1')
|
let s1 = Shell.new('1')
|
||||||
let s2 = Shell.new('2', 'for i in {1..10}; do echo hello $i!; sleep 1; done')
|
let s2 = Shell.new('2', 'for i in {1..10}; do echo hello $i!; sleep 1; done')
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
// that were previously invisible.
|
// that were previously invisible.
|
||||||
//
|
//
|
||||||
// The vterm->Neovim synchronization is performed in intervals of 10
|
// The vterm->Neovim synchronization is performed in intervals of 10
|
||||||
// milliseconds. This is done to minimize screen updates when receiving when
|
// milliseconds. This is done to minimize screen updates when receiving large
|
||||||
// receiving large bursts of data.
|
// bursts of data.
|
||||||
//
|
//
|
||||||
// This module is decoupled from the processes that normally feed it data, so
|
// This module is decoupled from the processes that normally feed it data, so
|
||||||
// it's possible to use it as a general purpose console buffer(possibly as a
|
// it's possible to use it as a general purpose console buffer(possibly as a
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ describe('jobs', function()
|
|||||||
nvim('command', "call jobstop(j)")
|
nvim('command', "call jobstop(j)")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('will not buffer data if it doesnt end in newlines', function()
|
it("will not buffer data if it doesn't end in newlines", function()
|
||||||
nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
|
nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
|
||||||
nvim('command', 'call jobsend(j, "abc\\nxyz")')
|
nvim('command', 'call jobsend(j, "abc\\nxyz")')
|
||||||
eq({'notification', 'stdout', {0, {'abc', 'xyz'}}}, next_msg())
|
eq({'notification', 'stdout', {0, {'abc', 'xyz'}}}, next_msg())
|
||||||
@@ -119,7 +119,7 @@ describe('jobs', function()
|
|||||||
eq({'notification', 'exit', {0, 0}}, next_msg())
|
eq({'notification', 'exit', {0, 0}}, next_msg())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('wont allow jobsend with a job that closed stdin', function()
|
it("won't allow jobsend with a job that closed stdin", function()
|
||||||
nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
|
nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
|
||||||
nvim('command', 'call jobclose(j, "stdin")')
|
nvim('command', 'call jobclose(j, "stdin")')
|
||||||
eq(false, pcall(function()
|
eq(false, pcall(function()
|
||||||
@@ -356,7 +356,7 @@ describe('jobs', function()
|
|||||||
nvim('command', 'call jobsend(j, "'..str..'")')
|
nvim('command', 'call jobsend(j, "'..str..'")')
|
||||||
end
|
end
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
-- the full path to tty-test seems to be required when running on travis.
|
-- the full path to tty-test seems to be required when running on travis.
|
||||||
insert(nvim_dir .. '/tty-test')
|
insert(nvim_dir .. '/tty-test')
|
||||||
nvim('command', 'let g:job_opts.pty = 1')
|
nvim('command', 'let g:job_opts.pty = 1')
|
||||||
|
|||||||
@@ -67,16 +67,16 @@
|
|||||||
--
|
--
|
||||||
-- NonText = Screen.colors.Blue
|
-- NonText = Screen.colors.Blue
|
||||||
-- screen:expect([[
|
-- screen:expect([[
|
||||||
-- hello screen \
|
-- hello screen |
|
||||||
-- ~ \
|
-- ~ |
|
||||||
-- ~ \
|
-- ~ |
|
||||||
-- ~ \
|
-- ~ |
|
||||||
-- ~ \
|
-- ~ |
|
||||||
-- ~ \
|
-- ~ |
|
||||||
-- ~ \
|
-- ~ |
|
||||||
-- ~ \
|
-- ~ |
|
||||||
-- ~ \
|
-- ~ |
|
||||||
-- {b:-- INSERT --} \
|
-- {b:-- INSERT --} |
|
||||||
-- ]], {b = {bold = true}}, {{bold = true, foreground = NonText}})
|
-- ]], {b = {bold = true}}, {{bold = true, foreground = NonText}})
|
||||||
--
|
--
|
||||||
-- In this case "b" is a string associated with the set composed of one
|
-- In this case "b" is a string associated with the set composed of one
|
||||||
@@ -221,7 +221,7 @@ function Screen:expect(expected, attr_ids, attr_ignore)
|
|||||||
local expected_row = expected_rows[i]
|
local expected_row = expected_rows[i]
|
||||||
local actual_row = self:_row_repr(self._rows[i], ids, ignore)
|
local actual_row = self:_row_repr(self._rows[i], ids, ignore)
|
||||||
if expected_row ~= actual_row then
|
if expected_row ~= actual_row then
|
||||||
return 'Row '..tostring(i)..' didnt match.\nExpected: "'..
|
return 'Row '..tostring(i)..' didn\'t match.\nExpected: "'..
|
||||||
expected_row..'"\nActual: "'..actual_row..'"'
|
expected_row..'"\nActual: "'..actual_row..'"'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user