From 41f375ee9e73e8ca77d857414dac669330aae336 Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrettruth@users.noreply.github.com> Date: Fri, 6 Mar 2026 11:55:37 -0500 Subject: [PATCH] fix: restore `buflisted` on jumplist buffer re-entry (#71) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: restore `buflisted` on jumplist buffer re-entry Problem: Neovim's jumplist machinery re-enters canola buffers via an internal `:edit`-equivalent path, which unconditionally sets `buflisted = true`. The existing workaround in `open()` and `open_float()` only covers canola-initiated navigation, leaving `` and `` unhandled. Solution: Apply the same `buf_options.buflisted` guard in the `BufEnter` autocmd, directly after `set_win_options()`. This fires on every buffer entry — including all jumplist paths — and mirrors the pattern already used at the two `:edit` callsites. * docs: mark upstream #302 as fixed in tracker --- doc/upstream.md | 3 ++- lua/canola/init.lua | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/upstream.md b/doc/upstream.md index f83b4a2..b85fa6e 100644 --- a/doc/upstream.md +++ b/doc/upstream.md @@ -28,6 +28,7 @@ Bugs fixed in this fork that remain open upstream. | Upstream issue | Description | PR | | ------------------------------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- | +| [#302](https://github.com/stevearc/oil.nvim/issues/302) | `buflisted=true` after jumplist nav | [#71](https://github.com/barrettruth/canola.nvim/pull/71) ([`a078bcf`](https://github.com/barrettruth/canola.nvim/commit/a078bcf)) | | [#632](https://github.com/stevearc/oil.nvim/issues/632) | Preview + move = copy | [#12](https://github.com/barrettruth/canola.nvim/pull/12) ([`fe16993`](https://github.com/barrettruth/canola.nvim/commit/fe16993)) | | [#642](https://github.com/stevearc/oil.nvim/issues/642) | W10 warning under `nvim -R` | [`ca834cf`](https://github.com/barrettruth/canola.nvim/commit/ca834cf) | | [#670](https://github.com/stevearc/oil.nvim/issues/670) | Multi-directory cmdline args ignored | [#11](https://github.com/barrettruth/canola.nvim/pull/11) ([`70861e5`](https://github.com/barrettruth/canola.nvim/commit/70861e5)) | @@ -74,7 +75,7 @@ addressed, `open` = not yet triaged. | [#289](https://github.com/stevearc/oil.nvim/issues/289) | open | Show absolute path toggle (P2) | | [#294](https://github.com/stevearc/oil.nvim/issues/294) | open | Can't handle emojis in filenames (P2) | | [#298](https://github.com/stevearc/oil.nvim/issues/298) | open | Open float on neovim directory startup (P2) | -| [#302](https://github.com/stevearc/oil.nvim/issues/302) | open | C-o parent nav makes buffer buflisted (P0) | +| [#302](https://github.com/stevearc/oil.nvim/issues/302) | fixed | `buflisted=true` after jumplist nav — [#71](https://github.com/barrettruth/canola.nvim/pull/71) ([`a078bcf`](https://github.com/barrettruth/canola.nvim/commit/a078bcf)) | | [#303](https://github.com/stevearc/oil.nvim/issues/303) | open | Preview in float window mode (P2) | | [#325](https://github.com/stevearc/oil.nvim/issues/325) | open | oil-ssh error from command line (P0) | | [#330](https://github.com/stevearc/oil.nvim/issues/330) | open | File opens in floating modal | diff --git a/lua/canola/init.lua b/lua/canola/init.lua index 5d6d06a..a728bdb 100644 --- a/lua/canola/init.lua +++ b/lua/canola/init.lua @@ -1343,6 +1343,9 @@ M.setup = function(opts) vim.fn.setreg('#', orig_buffer) end view.set_win_options() + if config.buf_options.buflisted ~= nil then + vim.api.nvim_set_option_value('buflisted', config.buf_options.buflisted, { buf = 0 }) + end vim.w.canola_did_enter = true elseif vim.fn.isdirectory(bufname) == 0 then -- Only run this logic if we are *not* in an canola buffer (and it's not a directory, which