Skip to content

Commit

Permalink
fix: vim.eval('v:true') should return python bool #506
Browse files Browse the repository at this point in the history
Signed-off-by: Mingxiang Xue <mingxiangxue@gmail.com>
  • Loading branch information
uzxmx committed May 12, 2022
1 parent 71102c0 commit d549371
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pynvim/plugin/script_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def writelines(self, seq):


def num_to_str(obj):
if isinstance(obj, num_types):
if isinstance(obj, num_types) and not isinstance(obj, bool):
return str(obj)
else:
return obj
Expand Down
7 changes: 7 additions & 0 deletions test/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,10 @@ def test_host_async_error(vim):
assert event[1] == 'nvim_error_event'
assert 'rplugin-host: Async request caused an error:\nboom\n' \
in h._on_error_event(None, 'boom')

def test_legacy_vim_eval(vim):
h = ScriptHost(vim)
assert h.legacy_vim.eval('1') == '1'
assert h.legacy_vim.eval('v:null') == None
assert h.legacy_vim.eval('v:true') == True
assert h.legacy_vim.eval('v:false') == False

0 comments on commit d549371

Please sign in to comment.