stevearc / oil.nvim

Neovim file explorer: edit your filesystem like a buffer
MIT License
4.01k stars 119 forks source link

bug: floating mode showing black backgrund color in transparent background #150

Closed amurahul closed 1 year ago

amurahul commented 1 year ago

Did you check the docs and existing issues?

Neovim version (nvim -v)

v0.9.1

Operating system/version

Linux 6.4.8-arch1-1 - Arch

Describe the bug

Black background in transparent theme, when initally opened. Tested in both Tokyonight and catppucin.

After changing directory it shows correctly.

Steps To Reproduce

  1. nvim -u repro.lua repro.lua
  2. :Oil --float
  3. or
  4. :lua require("oil").open_float()
  5. One can see black background
  6. Press - , to move to parent directory.
  7. Black background is removed, as it should have been.

https://github.com/stevearc/oil.nvim/assets/141751688/fdcdafbe-d275-41da-b49b-8ce11913f699

Expected Behavior

Black background shouldn't be there initially.

Directory structure

temp/temp/repo.lua

Repro

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
        "stevearc/oil.nvim",
        config = function()
            require("oil").setup({
              -- add any needed settings here
            })
       end,
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

require("tokyonight").setup({
    transparent = true,
    styles = {floats ="transparent"},
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Did you check the bug with a clean config?

stevearc commented 1 year ago

This is a bad interaction between transparent float backgrounds and winblend (looks like https://github.com/neovim/neovim/issues/18576). If you set the winblend to 0 then it works as expected.

            require("oil").setup({
              float = {
                win_options = {
                  winblend = 0
                }
              }
            })