You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
I've been messing with this, and hit a weird bug where if I called nvim.api.buf_set_lines, I got back the error pynvim.api.nvim.NvimError: b"object of type 'int' has no len()".
This was when calling it with 0, 0, -1, True.
Looking at the code for nvim_buf_get_lines and set lines, it looks like the first argument buffer is treated as the buffer, rather than the buffer index, as implied by the nvim docs :
Parameters:
{buffer} Buffer handle, or 0 for current buffer
Or over in
EXT Type C type Data
------------------------------------------------------------------------
Buffer enum value kObjectTypeBuffer |bufnr()|
I could be entirely wrong, and my code is just working oddly, but if I add in a buffer_contents = vim.buffers[buffer] (or I guess vim.current.buffer for buffer == 0) and then use buffer_contents rather than buffer, the set and get work as expected.
Is that expected, or am I just using the function wrong?
The text was updated successfully, but these errors were encountered:
# for freeto subscribe to this conversation on GitHub.
Already have an account?
#.
Hey!
I've been messing with this, and hit a weird bug where if I called
nvim.api.buf_set_lines
, I got back the errorpynvim.api.nvim.NvimError: b"object of type 'int' has no len()"
.This was when calling it with
0, 0, -1, True
.Looking at the code for
nvim_buf_get_lines
andset
lines, it looks like the first argumentbuffer
is treated as the buffer, rather than the buffer index, as implied by the nvim docs :Or over in
I could be entirely wrong, and my code is just working oddly, but if I add in a
buffer_contents = vim.buffers[buffer]
(or I guessvim.current.buffer
forbuffer == 0
) and then usebuffer_contents
rather thanbuffer
, theset
andget
work as expected.Is that expected, or am I just using the function wrong?
The text was updated successfully, but these errors were encountered: