@@ -19,7 +19,6 @@ 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
23
22
local View = Class :extend ()
24
23
25
24
--- @class View
@@ -236,12 +235,12 @@ local function switch_buf_if_last_buf()
236
235
end
237
236
end
238
237
239
- --- save any state that should be preserved on reopening
238
+ --- save_tab_state saves any state that should be preserved across redraws.
240
239
--- @private
241
240
--- @param tabid integer
242
241
function View :save_tab_state (tabid )
243
242
tabid = tabid or vim .api .nvim_get_current_tabpage ()
244
- self . cursor = vim .api .nvim_win_get_cursor (self :get_winid (tabid , " View:save_tab_state" ) or 0 )
243
+ globals . CURSORS [ tabid ] = vim .api .nvim_win_get_cursor (self :get_winid (tabid , " View:save_tab_state" ) or 0 )
245
244
end
246
245
247
246
--- @private
@@ -609,9 +608,9 @@ function View:api_winid(opts)
609
608
end
610
609
end
611
610
612
- --- restore any state from last close
613
- function View :restore_state ()
614
- self :set_cursor (self . cursor )
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 ()] )
615
614
end
616
615
617
616
--- winid containing the buffer
0 commit comments