@@ -302,7 +302,7 @@ H.root_cache = {}
302302--- Works only on Neovim>=0.10.
303303MiniMisc .setup_termbg_sync = function ()
304304 if vim .fn .has (' nvim-0.10' ) == 0 then
305- -- Handling `io.write('\027]11;?\007')` response was added in Neovim 0.10
305+ -- Handling `io.stdout: write('\027]11;?\007')` response was added in Neovim 0.10
306306 H .notify (' `setup_termbg_sync()` requires Neovim>=0.10' , ' WARN' )
307307 return
308308 end
@@ -326,13 +326,13 @@ MiniMisc.setup_termbg_sync = function()
326326 local sync = function ()
327327 local normal = vim .api .nvim_get_hl_by_name (' Normal' , true )
328328 if normal .background == nil then return end
329- io.write (string.format (' \027 ]11;#%06x\007 ' , normal .background ))
329+ io.stdout : write (string.format (' \027 ]11;#%06x\007 ' , normal .background ))
330330 end
331331 vim .api .nvim_create_autocmd ({ ' VimResume' , ' ColorScheme' }, { group = augroup , callback = sync })
332332
333333 -- Set up reset to the color returned from the very first call
334334 H .termbg_init = H .termbg_init or bg_init
335- local reset = function () io.write (' \027 ]11;' .. H .termbg_init .. ' \007 ' ) end
335+ local reset = function () io.stdout : write (' \027 ]11;' .. H .termbg_init .. ' \007 ' ) end
336336 vim .api .nvim_create_autocmd ({ ' VimLeavePre' , ' VimSuspend' }, { group = augroup , callback = reset })
337337
338338 -- Sync immediately
@@ -341,7 +341,7 @@ MiniMisc.setup_termbg_sync = function()
341341
342342 -- Ask about current background color and process the response
343343 local id = vim .api .nvim_create_autocmd (' TermResponse' , { group = augroup , callback = f , once = true , nested = true })
344- io.write (' \027 ]11;?\007 ' )
344+ io.stdout : write (' \027 ]11;?\007 ' )
345345 vim .defer_fn (function ()
346346 local ok = pcall (vim .api .nvim_del_autocmd , id )
347347 if ok then H .notify (' `setup_termbg_sync()` did not get response from terminal emulator' , ' WARN' ) end
0 commit comments