focus.nvim icon indicating copy to clipboard operation
focus.nvim copied to clipboard

fix: check for utils.disabled when changing signcolumn when leaving window

Open evertonse opened this issue 1 year ago • 1 comments

Check if focus is disabled when changing signcolumn when leaving (WinLeave).

This solves the signcolumn getting changed upon lost focus of NvimTree window in floating mode despite being sure that NvimTree is in the ignore_filetypes.

    local ignore_filetypes = { 'neo-tree', 'NvimTree' }
    vim.api.nvim_create_autocmd('FileType', {
      group = augroup,
      callback = function(_)
        local is_floating = vim.api.nvim_win_get_config(0).relative ~= ''
        if vim.tbl_contains(ignore_filetypes, vim.bo.filetype) or is_floating then
          vim.b.focus_disable = true
          print('recognized focus filetype = ' .. vim.bo.filetype)
        else
          vim.b.focus_disable = false
        end
      end,
      desc = 'Disable focus autoresize for FileType',
    })

Before

Signcolumn disappear after losing focus image

After

Corectly keeps the signcolumn padding when cursor leaves NvimTree window image

evertonse avatar Jul 19 '24 04:07 evertonse

Thank you very much for your contribution. Could you please add a test for it?

cryptomilk avatar Jul 19 '24 07:07 cryptomilk

Ping!

cryptomilk avatar Mar 04 '25 18:03 cryptomilk

Superseded by #177 which includes a test. Thanks.

cryptomilk avatar Nov 14 '25 16:11 cryptomilk