From 2fe4e7880789934672470fdca6886ae96c4f91f1 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 7 Mar 2026 16:49:12 -0500 Subject: [PATCH] feat(view): add `show_hidden_when_empty` for hidden-only directories Problem: with `show_hidden = false`, a directory containing only dotfiles renders as just `..`, giving no indication that entries exist. Solution: add `view_options.show_hidden_when_empty` (boolean, default false). After the main filter loop in `render_buffer`, if the option is set and `#line_table <= 1`, iterate `entry_list` again and render any entry not matched by `is_always_hidden`, using `is_hidden = true` so they render with the dimmed hidden style. Based on: stevearc/oil.nvim#473 --- lua/canola/view.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/canola/view.lua b/lua/canola/view.lua index 0f75faf..7a7ac89 100644 --- a/lua/canola/view.lua +++ b/lua/canola/view.lua @@ -807,6 +807,21 @@ local function render_buffer(bufnr, opts) end end + if config.view_options.show_hidden_when_empty and #line_table <= 1 then + for _, entry in ipairs(entry_list) do + local name = entry[FIELD_NAME] + local public_entry = util.export_entry(entry) + if not config.view_options.is_always_hidden(name, bufnr, public_entry) then + local cols = M.format_entry_cols(entry, column_defs, col_width, adapter, true, bufnr) + table.insert(line_table, cols) + if seek_after_render == name then + seek_after_render_found = true + jump_idx = #line_table + end + end + end + end + local lines, highlights = util.render_table(line_table, col_width, col_align) vim.bo[bufnr].modifiable = true