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:
parent
39374ee99b
commit
846efbb0f8
2 changed files with 137 additions and 134 deletions
|
|
@ -6,7 +6,7 @@ issues against this fork.
|
||||||
## Upstream PRs
|
## Upstream PRs
|
||||||
|
|
||||||
| PR | Description | Status |
|
| PR | Description | Status |
|
||||||
|----|-------------|--------|
|
| ----------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------ |
|
||||||
| [#495](https://github.com/stevearc/oil.nvim/pull/495) | Cancel visual/operator-pending mode on close | cherry-picked |
|
| [#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 |
|
| [#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 |
|
| [#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
|
## Issues
|
||||||
|
|
||||||
| Issue | Description | Status |
|
| Issue | Description | Status |
|
||||||
|-------|-------------|--------|
|
| ------------------------------------------------------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
||||||
| [#85](https://github.com/stevearc/oil.nvim/issues/85) | Git status column | open |
|
| [#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 |
|
| [#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 |
|
| [#117](https://github.com/stevearc/oil.nvim/issues/117) | Move file into new dir via slash in name | open |
|
||||||
|
|
|
||||||
|
|
@ -456,6 +456,9 @@ M.open = function(dir, opts, cb)
|
||||||
local util = require('canola.util')
|
local util = require('canola.util')
|
||||||
local view = require('canola.view')
|
local view = require('canola.view')
|
||||||
local parent_url, basename = M.get_url_for_path(dir)
|
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
|
if basename then
|
||||||
view.set_last_cursor(parent_url, basename)
|
view.set_last_cursor(parent_url, basename)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue