From a6ed68ee81546d5b74e26fa7b98b5c8509f83bc1 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 6 Mar 2026 16:14:42 -0500 Subject: [PATCH] fix: show float title when border is nil MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: the float title was only shown via the native `nvim_win_set_config` path, which requires a border to render. The guard `config.float.border ~= 'none'` did not account for `nil`, which is the default — so users with no explicit `border` config never saw the path title in the floating window. Solution: require both `~= nil` and `~= 'none'` before using the native title. In all other cases (border nil, 'none', or nvim < 0.9), fall back to `util.add_title_to_win`, which renders a child floating window for the title. Based on: stevearc/oil.nvim#683 --- doc/upstream.md | 2 +- lua/canola/init.lua | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/upstream.md b/doc/upstream.md index 238396a..a4b2753 100644 --- a/doc/upstream.md +++ b/doc/upstream.md @@ -148,7 +148,7 @@ Bugs fixed in this fork that remain open upstream. | [#678](https://github.com/stevearc/oil.nvim/issues/678) | tracking | `buftype='acwrite'` causes `mksession` to skip oil windows | | [#679](https://github.com/stevearc/oil.nvim/issues/679) | resolved | Executable file sign — PR [#698](https://github.com/stevearc/oil.nvim/pull/698) | | [#682](https://github.com/stevearc/oil.nvim/issues/682) | open | `get_current_dir()` nil in non-telescope context | -| [#683](https://github.com/stevearc/oil.nvim/issues/683) | open | Path not shown in floating mode | +| [#683](https://github.com/stevearc/oil.nvim/issues/683) | fixed | Path not shown in floating mode — title shown via fallback when border is nil | | [#684](https://github.com/stevearc/oil.nvim/issues/684) | open | User and group columns | | [#685](https://github.com/stevearc/oil.nvim/issues/685) | open | Plain directory paths in buffer names | | [#690](https://github.com/stevearc/oil.nvim/issues/690) | resolved | `OilFileIcon` highlight group — [`ce64ae1`](https://github.com/barrettruth/canola.nvim/commit/ce64ae1) | diff --git a/lua/canola/init.lua b/lua/canola/init.lua index a728bdb..5606708 100644 --- a/lua/canola/init.lua +++ b/lua/canola/init.lua @@ -305,8 +305,11 @@ M.open_float = function(dir, opts, cb) vim.api.nvim_set_option_value(k, v, { scope = 'local', win = winid }) end - -- Update the floating window title - if vim.fn.has('nvim-0.9') == 1 and config.float.border ~= 'none' then + if + vim.fn.has('nvim-0.9') == 1 + and config.float.border ~= nil + and config.float.border ~= 'none' + then local cur_win_opts = vim.api.nvim_win_get_config(winid) vim.api.nvim_win_set_config(winid, { relative = 'editor', @@ -316,6 +319,8 @@ M.open_float = function(dir, opts, cb) height = cur_win_opts.height, title = util.get_title(winid), }) + else + util.add_title_to_win(winid) end end, }) @@ -335,7 +340,7 @@ M.open_float = function(dir, opts, cb) end end) - if vim.fn.has('nvim-0.9') == 0 then + if vim.fn.has('nvim-0.9') == 0 or config.float.border == nil or config.float.border == 'none' then util.add_title_to_win(winid) end end