fix: Error on goto_location when code window closed
Mentioned by @gennaro-tedesco in #91
This commit is contained in:
@@ -32,8 +32,9 @@
|
|||||||
- Allow the preview window's width and height adapt to nvim window's resize.
|
- Allow the preview window's width and height adapt to nvim window's resize.
|
||||||
([#85](https://github.com/hedyhli/outline.nvim/pull/85))
|
([#85](https://github.com/hedyhli/outline.nvim/pull/85))
|
||||||
- Keybinding to close the outline will exit neovim if it is the last window
|
- Keybinding to close the outline will exit neovim if it is the last window
|
||||||
remaining; previously this throwed an error.
|
remaining; previously this threw an error.
|
||||||
([#91](https://github.com/hedyhli/outline.nvim/pull/91))
|
([#91](https://github.com/hedyhli/outline.nvim/pull/91))
|
||||||
|
- Prevent an error on attempt to `goto_location` when code window is closed.
|
||||||
|
|
||||||
## v1.0.0
|
## v1.0.0
|
||||||
|
|
||||||
|
|||||||
@@ -386,6 +386,11 @@ function Sidebar:__goto_location(change_focus)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not vim.api.nvim_win_is_valid(self.code.win) then
|
||||||
|
vim.notify("outline.nvim: Code window closed", vim.log.levels.WARN)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
vim.api.nvim_win_set_cursor(self.code.win, { node.line + 1, node.character })
|
vim.api.nvim_win_set_cursor(self.code.win, { node.line + 1, node.character })
|
||||||
|
|
||||||
if cfg.o.outline_window.center_on_jump then
|
if cfg.o.outline_window.center_on_jump then
|
||||||
|
|||||||
Reference in New Issue
Block a user