@@ -19,6 +19,7 @@ local Class = require("nvim-tree.classic")
19
19
--- @field private max_width integer
20
20
--- @field private padding integer
21
21
--- @field private bufnr_by_tabid table<integer , integer> stored per tab until multi-instance is complete
22
+ --- @field private cursor integer[] as per vim.api.nvim_win_get_cursor
22
23
local View = Class :extend ()
23
24
24
25
--- @class View
@@ -235,12 +236,12 @@ local function switch_buf_if_last_buf()
235
236
end
236
237
end
237
238
238
- --- save_tab_state saves any state that should be preserved across redraws.
239
+ --- save any state that should be preserved on reopening
239
240
--- @private
240
241
--- @param tabid integer
241
242
function View :save_tab_state (tabid )
242
243
tabid = tabid or vim .api .nvim_get_current_tabpage ()
243
- globals . CURSORS [ tabid ] = vim .api .nvim_win_get_cursor (self :get_winid (tabid , " View:save_tab_state" ) or 0 )
244
+ self . cursor = vim .api .nvim_win_get_cursor (self :get_winid (tabid , " View:save_tab_state" ) or 0 )
244
245
end
245
246
246
247
--- @private
@@ -608,9 +609,9 @@ function View:api_winid(opts)
608
609
end
609
610
end
610
611
611
- --- Restores the state of a NvimTree window if it was initialized before.
612
- function View :restore_tab_state ()
613
- self :set_cursor (globals . CURSORS [ vim . api . nvim_get_current_tabpage ()] )
612
+ --- restore any state from last close
613
+ function View :restore_state ()
614
+ self :set_cursor (self . cursor )
614
615
end
615
616
616
617
--- winid containing the buffer
0 commit comments