Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

nvim_buf_get_lines not working #60

@CrossR

Description

@CrossR

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 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions