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:
parent
39374ee99b
commit
c7b905137c
2 changed files with 137 additions and 134 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue