paste: handle 'nomodifiable'

- nvim_paste(): Marshal through luaeval() instead of nvim_execute_lua()
  because the latter seems to hide some errors.
- Handle 'nomodifiable' in `nvim_put()` explicitly.
- Require explicit `false` from `vim.paste()` in order to "cancel",
  otherwise assume true ("continue").
This commit is contained in:
Justin M. Keyes
2019-08-27 05:19:32 +02:00
parent 87389c6a57
commit 46aa254bf3
3 changed files with 75 additions and 12 deletions

View File

@@ -409,6 +409,11 @@ describe('API', function()
expect_err("Invalid type: 'x'", request,
'nvim_put', {'foo'}, 'x', false, false)
end)
it("fails if 'nomodifiable'", function()
command('set nomodifiable')
expect_err([[Buffer is not 'modifiable']], request,
'nvim_put', {'a','b'}, 'l', true, true)
end)
it('inserts text', function()
-- linewise
nvim('put', {'line 1','line 2','line 3'}, 'l', true, true)