fix: make parent action a no-op at filesystem root (#109)

Problem: at the filesystem root (`/`), `actions.parent` triggers a
full `vim.cmd.edit()` and async re-render cycle even though the parent
of `/` is `/`.

Solution: in `canola.open()`, return early when `parent_url` equals
the current buffer name.

Closes #108.
This commit is contained in:
Barrett Ruth 2026-03-09 18:05:04 -04:00 committed by GitHub
parent 39374ee99b
commit c7b905137c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 137 additions and 134 deletions

View file

@ -456,6 +456,9 @@ M.open = function(dir, opts, cb)
local util = require('canola.util')
local view = require('canola.view')
local parent_url, basename = M.get_url_for_path(dir)
if parent_url == vim.api.nvim_buf_get_name(0) then
return
end
if basename then
view.set_last_cursor(parent_url, basename)
end