fix: make parent action a no-op at filesystem root

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:00:50 -04:00
parent 39374ee99b
commit 846efbb0f8
2 changed files with 137 additions and 134 deletions

View file

@ -6,7 +6,7 @@ issues against this fork.
## Upstream PRs
| PR | Description | Status |
|----|-------------|--------|
| ----------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------ |
| [#495](https://github.com/stevearc/oil.nvim/pull/495) | Cancel visual/operator-pending mode on close | cherry-picked |
| [#537](https://github.com/stevearc/oil.nvim/pull/537) | Configurable file/directory creation permissions | cherry-picked |
| [#618](https://github.com/stevearc/oil.nvim/pull/618) | Opt-in filetype detection for icons | cherry-picked |
@ -33,7 +33,7 @@ issues against this fork.
## Issues
| Issue | Description | Status |
|-------|-------------|--------|
| ------------------------------------------------------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| [#85](https://github.com/stevearc/oil.nvim/issues/85) | Git status column | open |
| [#95](https://github.com/stevearc/oil.nvim/issues/95) | Undo after renaming files | open |
| [#117](https://github.com/stevearc/oil.nvim/issues/117) | Move file into new dir via slash in name | open |

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