nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.24k stars 815 forks source link

`which_key` action popup is not rendered correctly in neovide #2976

Closed pidgeon777 closed 4 months ago

pidgeon777 commented 5 months ago

Description

As the title says, when displaying the which_key action popup, the popup is not rendered correctly.

Sometimes keys are not displayed:

image

Sometimes they are, but the popup is still not displayed as the topmost layer:

image

Neovim version

NVIM v0.10.0-dev-2513+g0ffc92649
Build type: RelWithDebInfo
LuaJIT 2.1.1707061634
Run "nvim -V1 -v" for more info

Operating system and version

Windows 11 Version 23H2

Telescope version / branch / rev

telescope 1.0.5 @ master

checkhealth telescope

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

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 14.1.0 (rev e50df40a19)
- OK fd: found fd 9.0.0

===== Installed extensions ===== ~

Telescope Extension: `aerial` ~
- No healthcheck provided

Telescope Extension: `everything` ~
- No healthcheck provided

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Telescope Extension: `lazy_plugins` ~
- OK Lazy configuration file was found.
- OK Path to Lazy plugins spec table file found.

Telescope Extension: `projects` ~
- No healthcheck provided

Steps to reproduce

  1. Install the LazyVim plugin
  2. Define a new which-key_cfg.lua file in the plugins directory:
return {
  {
    "nvim-telescope/telescope.nvim",
    opts = function(_, opts)
      local actions = require("telescope.actions")
      opts.defaults = vim.tbl_deep_extend("force", opts.defaults or {}, {
        mappings = {
          i = {
            ["<C-<>"] = actions.which_key,
          },
          n = {
            ["<C-<>"] = actions.which_key,
          },
        },
      })
    end,
  },
}

Expected behavior

I would expect the which_key Telescope popup to appears always on the top layer and also with all of the commands shown.

Also, it would be nice to have a way to configure the which_key popup to appear for example on the top, or on the bottom.

Actual behavior

See above.

Minimal config

See above.
jamestrew commented 5 months ago

I'm not able to reproduce this. image

Please try with this minimal config. LazyVim isn't a minimal config.

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "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",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    config = function()
      require("telescope").setup({})
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

You can copy this somewhere as min.lua and start neovim with nvim -nu min.lua.

It's possible this is neovide related but I wouldn't know what to really do about that.

so-rose commented 5 months ago

I've encountered this bug too, but only on Neovide. I've made an issue there, referring here.

jamestrew commented 5 months ago

Thanks, it's possible it's still a telescope issue (maybe even likely) but I'm not a neovide user and don't really know anything about neovim GUIs so any help I can get would be appreciated.

fredizzimo commented 5 months ago

The issue here is that both Windows use the z-index 50, the which key popup should have a higher z-index.

In the terminal it only works by chance, or because of some implementation details, but a GUI, like Neovide does not get any other information than the z-index to sort the windows by.

jamestrew commented 5 months ago

@fredizzimo Thank you, with that info it should be a fairly easy fix. I'll try to get to this shortly.