mirror of
https://github.com/neovim/neovim.git
synced 2025-12-05 14:13:10 +00:00
api: change nvim_command_output behavior
Implement nvim_command_output with `execute({cmd},"silent")`.
Behavior changes:
- does not provoke any hit-enter prompt
- no longer prepends a newline char
- does not capture some noise (like the "[New File]" message, see the
change to tabnewentered_spec.lua)
Technically ("bug-for-bug") this a breaking change. But the previous
behavior of nvim_command_output meant that it probably wasn't used for
anything outside of tests.
Also remove the undocumented `v:command_output` variable which was
a hack introduced only for the purposes of nvim_command_output.
closes #7726
This commit is contained in:
@@ -644,7 +644,7 @@ local function alter_slashes(obj)
|
||||
end
|
||||
|
||||
local function hexdump(str)
|
||||
local len = string.len( str )
|
||||
local len = string.len(str)
|
||||
local dump = ""
|
||||
local hex = ""
|
||||
local asc = ""
|
||||
@@ -652,22 +652,20 @@ local function hexdump(str)
|
||||
for i = 1, len do
|
||||
if 1 == i % 8 then
|
||||
dump = dump .. hex .. asc .. "\n"
|
||||
hex = string.format( "%04x: ", i - 1 )
|
||||
hex = string.format("%04x: ", i - 1)
|
||||
asc = ""
|
||||
end
|
||||
|
||||
local ord = string.byte( str, i )
|
||||
hex = hex .. string.format( "%02x ", ord )
|
||||
local ord = string.byte(str, i)
|
||||
hex = hex .. string.format("%02x ", ord)
|
||||
if ord >= 32 and ord <= 126 then
|
||||
asc = asc .. string.char( ord )
|
||||
asc = asc .. string.char(ord)
|
||||
else
|
||||
asc = asc .. "."
|
||||
end
|
||||
end
|
||||
|
||||
return dump .. hex
|
||||
.. string.rep( " ", 8 - len % 8 ) .. asc
|
||||
|
||||
return dump .. hex .. string.rep(" ", 8 - len % 8) .. asc
|
||||
end
|
||||
|
||||
local module = {
|
||||
|
||||
Reference in New Issue
Block a user