Closed wincent closed 1 year ago
Thanks for the report!
Definitely not by design, but it's a consequence of this logic in the buffer finder:
vim.api.nvim_list_bufs()
vim.api.nvim_buf_is_loaded()
; if it is:vim.api.nvim_buf_get_name()
; and:vim.fn.fnamemodify()
.So, the intent of the nvim_buf_is_loaded
check is to skip over "unloaded" buffers, which can cause problems. The api-buffer
docs say this about unloaded buffers:
Unloaded Buffers: ~
Buffers may be unloaded by the |:bunload| command or the buffer's
|'bufhidden'| option. When a buffer is unloaded its file contents are
freed from memory and vim cannot operate on the buffer lines until it is
reloaded (usually by opening the buffer again in a new window). API
methods such as |nvim_buf_get_lines()| and |nvim_buf_line_count()| will be
affected.
I'm concerned that if I remove the nvim_buf_is_loaded
check I'll wind up introducing a regression; but I didn't have this kind of thing in the Ruby version (the scanner was just parsing :ls
output), so this code is pretty new (added in 0b8c9ed39c1352e3ed00798c7269385a69b7748a, "feat(lua): continue sketching out UI", July 20, 2022).
I can certainly play around with removing it, and if I can't do that, I might be able to do some special-casing to detect when Neovim has just launched and skip the check in that case...
Thanks @wincent that's fixed it for me! I appreciate your efforts.
Originally posted by @jaapie in https://github.com/wincent/command-t/issues/394#issuecomment-1635253772