Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(pinned): buffer does not exist after switching sessions #963

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zkygr
Copy link

@zkygr zkygr commented Sep 15, 2024

Hello,

I've been experimenting with pinned buffers and sessions, and I encountered an error.

Steps to reproduce:

  • Pin a buffer
  • Restore a Vim session
  • Pin another buffer

Error Message:

Error executing Lua callback: ...hare/nvim/lazy/bufferline.nvim/lua/bufferline/groups.lua:154: Invalid buffer id: 3
stack traceback:
        [C]: in function 'nvim_buf_get_name'
        ...hare/nvim/lazy/bufferline.nvim/lua/bufferline/groups.lua:154: in function 'persist_pinned_buffers'
        ...hare/nvim/lazy/bufferline.nvim/lua/bufferline/groups.lua:323: in function 'add_element'
        ...hare/nvim/lazy/bufferline.nvim/lua/bufferline/groups.lua:486: in function 'toggle_pin'
        ...local/share/nvim/lazy/bufferline.nvim/lua/bufferline.lua:172: in function <...local/share/nvim/lazy/bufferline.nvim/lua/bufferline.lua:172>

Video:

bufferline_error.webm

I believe a possible solution could be updating the buffer IDs, but I wanted to get another opinion before spending more time on it. My current fix only suppresses the error messages, but the incorrect buffer IDs are still in memory. Perhaps I'm overlooking something.

1) After restoring a session, the buffer ids have changed and the old
   ones are not valid.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant