This fixes a bunch of errors I was getting when switching away from the avante sidebar and then back. Sometimes the sidebar would lose track of the various windows, and you'd get errors like this: ``` || stack traceback: || ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2350: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2349> || Error detected while processing BufLeave Autocommands for "<buffer=294>": || Error executing lua callback: ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2398: attempt to index field 'selected_files_container' (a nil value) ``` Or this one: ``` || stack traceback: || ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2350: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2349> || Error detected while processing BufLeave Autocommands for "<buffer=294>": || Error executing lua callback: ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2398: attempt to index field 'selected_files_container' (a nil value) ``` This change does the following: 1. Proper order of cleanup in `reset()` 2. Proper cleanup in `create_selected_files_container()`
77 KiB
77 KiB