@@ -75,7 +75,8 @@ local function pick_win_id()
75
75
end
76
76
77
77
local i = 1
78
- local win_opts = {}
78
+ local win_opts_selectable = {}
79
+ local win_opts_unselectable = {}
79
80
local win_map = {}
80
81
local laststatus = vim .o .laststatus
81
82
vim .o .laststatus = 2
@@ -89,19 +90,16 @@ local function pick_win_id()
89
90
90
91
if laststatus == 3 then
91
92
for _ , win_id in ipairs (not_selectable ) do
92
- local ok_status , statusline , ok_hl , winhl
93
+ local ok_status , statusline
93
94
94
95
if vim .fn .has (" nvim-0.10" ) == 1 then
95
96
ok_status , statusline = pcall (vim .api .nvim_get_option_value , " statusline" , { win = win_id })
96
- ok_hl , winhl = pcall (vim .api .nvim_get_option_value , " winhl" , { win = win_id })
97
97
else
98
98
ok_status , statusline = pcall (vim .api .nvim_win_get_option , win_id , " statusline" ) --- @diagnostic disable-line : deprecated
99
- ok_hl , winhl = pcall (vim .api .nvim_win_get_option , win_id , " winhl" ) --- @diagnostic disable-line : deprecated
100
99
end
101
100
102
- win_opts [win_id ] = {
101
+ win_opts_unselectable [win_id ] = {
103
102
statusline = ok_status and statusline or " " ,
104
- winhl = ok_hl and winhl or " " ,
105
103
}
106
104
107
105
-- Clear statusline for windows not selectable
@@ -126,7 +124,7 @@ local function pick_win_id()
126
124
ok_hl , winhl = pcall (vim .api .nvim_win_get_option , id , " winhl" ) --- @diagnostic disable-line : deprecated
127
125
end
128
126
129
- win_opts [id ] = {
127
+ win_opts_selectable [id ] = {
130
128
statusline = ok_status and statusline or " " ,
131
129
winhl = ok_hl and winhl or " " ,
132
130
}
@@ -156,7 +154,7 @@ local function pick_win_id()
156
154
157
155
-- Restore window options
158
156
for _ , id in ipairs (selectable ) do
159
- for opt , value in pairs (win_opts [id ]) do
157
+ for opt , value in pairs (win_opts_selectable [id ]) do
160
158
if vim .fn .has (" nvim-0.10" ) == 1 then
161
159
vim .api .nvim_set_option_value (opt , value , { win = id })
162
160
else
@@ -169,7 +167,7 @@ local function pick_win_id()
169
167
for _ , id in ipairs (not_selectable ) do
170
168
-- Ensure window still exists at this point
171
169
if vim .api .nvim_win_is_valid (id ) then
172
- for opt , value in pairs (win_opts [id ]) do
170
+ for opt , value in pairs (win_opts_unselectable [id ]) do
173
171
if vim .fn .has (" nvim-0.10" ) == 1 then
174
172
vim .api .nvim_set_option_value (opt , value , { win = id })
175
173
else
0 commit comments