@@ -696,7 +696,7 @@ function FzfWin:reset_win_highlights(win)
696696 end
697697 end
698698 end
699- utils .wo [win ].winhl = hl
699+ ( key == " prev " and utils .wo [win ] or utils . wo [ win ][ 0 ]) .winhl = hl
700700end
701701
702702--- @param exit_code integer
@@ -873,15 +873,17 @@ end
873873--- @param win integer
874874--- @param opts vim.wo |{}
875875--- @param ignore_events boolean ?
876- function FzfWin :set_winopts (win , opts , ignore_events )
876+ --- @param global boolean ?
877+ function FzfWin :set_winopts (win , opts , ignore_events , global )
877878 local _ = self
878879 if not win or not api .nvim_win_is_valid (win ) then return end
879880 -- NOTE: Do not trigger "OptionSet" as this will trigger treesitter-context's
880881 -- `update_single_context` which will in turn close our treesitter-context
881882 local ei = ignore_events and " all" or vim .o .eventignore
883+ local wo = global ~= false and utils .wo [win ] or utils .wo [win ][0 ]
882884 utils .eventignore (function ()
883885 for opt , value in pairs (opts ) do
884- utils . wo [ win ] [opt ] = value
886+ wo [opt ] = value
885887 end
886888 end , ei )
887889end
@@ -1166,20 +1168,22 @@ function FzfWin:save_style_minimal(winid)
11661168 })
11671169end
11681170
1169- function FzfWin :set_style_minimal (winid )
1171+ --- @param winid integer
1172+ --- @param global boolean If true , ' wo' can be inherited by other windows /buffers
1173+ function FzfWin :set_style_minimal (winid , global )
11701174 local _ = self
11711175 if not tonumber (winid ) or not api .nvim_win_is_valid (winid ) then return end
1172- utils . wo [ winid ]. number = false
1173- utils . wo [ winid ]. relativenumber = false
1174- -- TODO: causes issues with winopts.split=enew
1175- -- why do we need this in a terminal window?
1176- -- utils.wo[winid].cursorline = false
1177- utils . wo [ winid ]. cursorcolumn = false
1178- utils . wo [ winid ]. spell = false
1179- utils . wo [ winid ]. list = false
1180- utils . wo [ winid ]. signcolumn = " no "
1181- utils . wo [ winid ]. foldcolumn = " 0 "
1182- utils . wo [ winid ]. colorcolumn = " "
1176+ self : set_winopts ( winid , {
1177+ number = false ,
1178+ relativenumber = false ,
1179+ cursorline = false ,
1180+ cursorcolumn = false ,
1181+ spell = false ,
1182+ list = false ,
1183+ signcolumn = " no " ,
1184+ foldcolumn = " 0 " ,
1185+ colorcolumn = " " ,
1186+ }, false , global )
11831187end
11841188
11851189function FzfWin :create ()
@@ -1256,7 +1260,7 @@ function FzfWin:create()
12561260 end
12571261
12581262 -- match window options with 'nvim_open_win' style:minimal
1259- self :set_style_minimal (self .fzf_winid )
1263+ self :set_style_minimal (self .fzf_winid , false )
12601264 else
12611265 -- draw the main window
12621266 self :redraw_main ()
@@ -1274,7 +1278,7 @@ function FzfWin:create()
12741278
12751279 -- potential workarond for `<C-c>` freezing neovim (#1091)
12761280 -- https://github.com/neovim/neovim/issues/20726
1277- utils .wo [self .fzf_winid ].foldmethod = " manual"
1281+ utils .wo [self .fzf_winid ][ 0 ] .foldmethod = " manual"
12781282
12791283 if type (self .winopts .on_create ) == " function" then
12801284 self .winopts .on_create ({ winid = self .fzf_winid , bufnr = self .fzf_bufnr })
@@ -1337,7 +1341,7 @@ function FzfWin:close(fzf_bufnr, hide, hidden)
13371341 if self .src_winid == self .fzf_winid then
13381342 -- "split" reused the current win (e.g. "enew")
13391343 -- restore the original buffer and styling options
1340- self :set_winopts (self .fzf_winid , self .src_winid_style or {})
1344+ self :set_winopts (self .fzf_winid , self .src_winid_style or {}, false )
13411345 -- buf may be invalid if we switched away from a scratch buffer
13421346 if api .nvim_buf_is_valid (self .src_bufnr ) then
13431347 -- TODO: why does ignoring events cause the cursor to move to the wrong position?
0 commit comments