sainnhe / everforest

🌲 Comfortable & Pleasant Color Scheme for Vim
MIT License
2.94k stars 132 forks source link

Inconsistent background inside floating windows #123

Closed tjgrhm closed 1 year ago

tjgrhm commented 1 year ago

I have done the following steps before reporting this issue:

Operating system/version

Arch

Terminal emulator/version

Kitty 0.28.1

$TERM environment variable

xterm-kitty

Tmux version

No response

Feature matrix

==============================================================================
lazy: require("lazy.health").check()

lazy.nvim ~
- OK Git installed
- OK no existing packages found by other package managers
- OK packer_compiled.lua not found

==============================================================================
nvim: require("nvim.health").check()

Configuration ~
- WARNING Missing user config file: /home/tjgrhm/.config/nvim/init.vim
  - ADVICE:
    - :help |init.vim|

Runtime ~
- OK $VIMRUNTIME: /usr/share/nvim/runtime

Performance ~
- OK Build type: Release

Remote Plugins ~
- OK Up to date

terminal ~
- key_backspace (kbs) terminfo entry: `key_backspace=\177`
- key_dc (kdch1) terminfo entry: `key_dc=\E[3~`
- $COLORTERM="truecolor"

==============================================================================
provider: health#provider#check

Clipboard (optional) ~
- OK Clipboard tool found: xclip

Python 3 provider (optional) ~
- WARNING No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
- WARNING Could not load Python 3:
  /usr/bin/python3 does not have the "neovim" module.
  python3.10 not found in search path or not executable.
  python3.9 not found in search path or not executable.
  python3.8 not found in search path or not executable.
  python3.7 not found in search path or not executable.
  /usr/bin/python does not have the "neovim" module.
  - ADVICE:
    - See :help |provider-python| for more information.
    - You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim
- Executable: Not found

Python virtualenv ~
- OK no $VIRTUAL_ENV

Ruby provider (optional) ~
- WARNING `ruby` and `gem` must be in $PATH.
  - ADVICE:
    - Install Ruby and verify that `ruby` and `gem` commands work.

Node.js provider (optional) ~
- Node.js: v20.4.0
- WARNING Missing "neovim" npm (or yarn, pnpm) package.
  - ADVICE:
    - Run in shell: npm install -g neovim
    - Run in shell (if you use yarn): yarn global add neovim
    - Run in shell (if you use pnpm): pnpm install -g neovim
    - You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim

Perl provider (optional) ~
- WARNING "Neovim::Ext" cpan module is not installed
  - ADVICE:
    - See :help |provider-perl| for more information.
    - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

==============================================================================
vim.lsp: require("vim.lsp.health").check()

- LSP log level : WARN
- Log path: /home/tjgrhm/.local/state/nvim/lsp.log
- Log size: 266 KB

vim.lsp: Active Clients ~
- No active clients

==============================================================================
vim.treesitter: require("vim.treesitter.health").check()

- Nvim runtime ABI version: 14
- OK Parser: c          ABI: 13, path: /usr/lib/nvim/parser/c.so
- OK Parser: lua        ABI: 14, path: /usr/lib/nvim/parser/lua.so
- OK Parser: query      ABI: 14, path: /usr/lib/nvim/parser/query.so
- OK Parser: vim        ABI: 14, path: /usr/lib/nvim/parser/vim.so
- OK Parser: vimdoc     ABI: 14, path: /usr/lib/nvim/parser/vimdoc.so

Minimal vimrc that can reproduce this bug.

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

vim.opt.termguicolors = true

require("lazy").setup({
    { "sainnhe/everforest", lazy = false, priority = 1000, config = function() vim.cmd.colorscheme("everforest") end }
})

Steps to reproduce this bug using minimal vimrc

  1. Launch neovim with neovim -u init.lua.
  2. Open floating window with :Lazy.

Expected behavior

I would expect the background of a floating window to stay consistent after its buffer has ended, having the appearance of filling the entire space it was allocated. For instance, with the habamax theme: image

Actual behavior

Instead, with everforest the background only fills part of the floating window and the normal background is used after the floating window's buffer ends. image This appears to be because the EndOfBuffer highlight group has a background value set (whereas habamax does not set this). Note that setting g:everforest_transparent_background=1 does resolve this, but also makes everything else transparent too.

antoineco commented 1 year ago

Good catch. I also noticed that on the Lazy screen.

Here is a reference to the commit which introduced the feature: 6510c08c90523c92a0e9aa1474621c9fb825a44f If I remember correctly, it was introduced for NvimTree: https://github.com/sainnhe/everforest/issues/111#issuecomment-1347735032.

We could probably re-visit this because

  1. NvimTree has its own NvimTreeEndOfBuffer highlight group.
  2. If I set :hi! link EndOfBuffer NonText (Neovim's default), everything seems to get displayed as expected.
antoineco commented 1 year ago

Before I push that change, here is a recap — with screenshots — of the way EndOfBuffer looks with a few settings variations.

While some cases below work flawlessly with a cleared EndOfBuffer background, others will have trade-off which users should be aware of.


show_eob:true dim_inactive:false

✅ Everything looks as expected

showeob_true_diminactive_false_current _show_eob:true diminactive:false (current)

showeob_true_diminactive_false _show_eob:true diminactive:false (clear EndOfBuffer bg)


show_eob:false dim_inactive:false

✅ Everything looks as expected

showeob_false_diminactive_false_current _show_eob:false diminactive:false (current)

showeob_false_diminactive_false _show_eob:false diminactive:false (clear EndOfBuffer bg)


show_eob:true dim_inactive:true

✅⚠️ The current appearance seems broken, with an entirely dimmed eob. I am not the author of the dimming feature, but to me this doesn't seem intentional, and I believe that the suggested change actually fixes it.

showeob_true_diminactive_true_current _show_eob:true diminactive:true (current)

showeob_true_diminactive_true _show_eob:true diminactive:true (clear EndOfBuffer bg)


show_eob:false dim_inactive:true

⚠️ Similarly to the above, the current appearance seems broken, with an entirely dimmed eob. In this case though, clearing the background color reveals the eob symbols in the current window, while keeping them hidden in inactive windows. I believe that this is an acceptable trade-off for having properly rendered floating windows everywhere. If need be, we can always revert the appearance (optimize for the active window instead) in a subsequent commit. (edit: addressed in 4eb1e19899e35544dea3e01092d51cfaf2334e3d)

showeob_false_diminactive_true_current _show_eob:false diminactive:true (current)

showeob_false_diminactive_true _show_eob:false diminactive:true (clear EndOfBuffer bg)


Note NvimTree's EndOfBuffer isn't affected by any of these:

nvimtree_eob