Skip to content

Float window for full filenames has wrong bg #2746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
simonmandlik opened this issue Apr 11, 2024 · 2 comments · Fixed by #3128
Closed

Float window for full filenames has wrong bg #2746

simonmandlik opened this issue Apr 11, 2024 · 2 comments · Fixed by #3128
Labels
bug Something isn't working PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated reproduced Issue confirmed

Comments

@simonmandlik
Copy link
Collaborator

simonmandlik commented Apr 11, 2024

Description

Setting full_name = true, there is an inconsistent color of the background of the floating window, depending on culopt settting in neovim.

Neovim version

NVIM v0.10.0-dev-2274+g1d5f86f69-Homebrew
Build type: Release
LuaJIT 2.1.1703358377

Operating system and version

macOS 14.4.1

Windows variant

No response

nvim-tree version

81eb8d5

Clean room replication

vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvt-min/site]]
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
  require("packer").startup {
    {
      "wbthomason/packer.nvim",
      "nvim-tree/nvim-tree.lua",
      "nvim-tree/nvim-web-devicons",
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. "/plugin/packer_compiled.lua",
      display = { non_interactive = true },
    },
  }
end
if vim.fn.isdirectory(install_path) == 0 then
  print "Installing nvim-tree and dependencies."
  vim.fn.system { "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path }
end
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]]
vim.opt.termguicolors = true
vim.opt.cursorline = true

-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
vim.opt.culopt = "number"
_G.setup = function()
    require("nvim-tree").setup {
        view = { cursorline = true },
        renderer = { full_name = true, }
    }
end

Steps to reproduce

  1. nvim -nu /tmp/nvt-min.lua
  2. :NvimOpenTree

Expected behavior

I would expect to either show no cursorline at all (there are no numbers in nvim tree), or the floating window bg to be consistent with cursorline bg for shorter items.

Actual behavior

Screen.Recording.2024-04-11.at.11.34.32.mov
@simonmandlik simonmandlik added the bug Something isn't working label Apr 11, 2024
@alex-courtis
Copy link
Member

Reproduced:

20240415_165725

@alex-courtis alex-courtis added the reproduced Issue confirmed label Apr 15, 2024
@alex-courtis
Copy link
Member

alex-courtis commented Apr 16, 2024

&cursorline is always set for the float, but only for the tree window when view.cursorline is set.

&cursorlineopt is always set to "both" for the tree window and never for the float window.

That can be fixed.

In full-name show() we'll need to set cursorline cursorlineopt=both only when view.cursorline is set.

This surfaces a problem: when cursorline is not shown in the float, it shows the default float background. This is different from the tree and will need to be explicitly set. Many View.winopts.winhl should be applied.

@alex-courtis alex-courtis added the PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated label Apr 16, 2024
alex-courtis added a commit that referenced this issue May 24, 2025
…3128)

* fix(#2746): fix cursorcolumn and right aligned icons in floating windows

* feat: remove right aligned icons from full name float, show float over right aligned icons

* refactoring: move `extmarks_length` to utils.lua

* fix: decrease `win_width` instead of increasing `text_width` when computing condition for full name float to show

---------

Co-authored-by: Alexander Courtis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated reproduced Issue confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants