stevearc / dressing.nvim

Neovim plugin to improve the default vim.ui interfaces
MIT License
1.73k stars 32 forks source link

Telescope File Browser appears above dressing and dressing UI does not get focus #43

Closed benfrain closed 2 years ago

benfrain commented 2 years ago

Describe the bug When using Telescope File Browser the Dressing UI appears behind the Telescope File Browser UI, and doesn't receive focus. Unsure if this problem is Dressing, Telescope File Browser, or my config related — usually it's me but I am just using defaults. :)

Sincere apologies in advance if it turns out to be the latter!

System information

use({ "stevearc/dressing.nvim" })

To Reproduce Steps to reproduce the behavior:

  1. Use Telescope File Browser and duplicate/rename a file
  2. Observe that dressing UI is behind the File Browser and doesn't receive focus

Screenshots

https://user-images.githubusercontent.com/1318466/171199415-b447602d-92ed-4201-975f-1a08ef4371f5.mov

stevearc commented 2 years ago

Not sure what's going on here. I installed telescope file browser to try it out, but it seems to be working fine for me. I could give you a config override that would adjust the z-index and probably fix the over/under rendering, but the bigger issue is the lack of focus and I'm not sure what could be causing that.

The method I've used to debug interactions like this (though I hate it) is to comment out a half of my config, retry, comment out another half, retry, and slowly bisect my way to figuring out what's causing the problem.

benfrain commented 2 years ago

@stevearc thanks for taking a look. If it also works fine for you I'll try exactly as you describe and strip my config right back and build it up one at a time. I'll close this as you are not able to reproduce but add a comment when I figure out what it causing it. Thanks.

benfrain commented 2 years ago

Well had a crack at this but none the wiser. Here is the packer config I now have:

local packer_group = vim.api.nvim_create_augroup("Packer", { clear = true })
vim.api.nvim_create_autocmd(
  "BufWritePost",
  { command = "source <afile> | PackerCompile", group = packer_group, pattern = "plugins.lua" }
)

local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
  packer_bootstrap = fn.system({
    "git",
    "clone",
    "--depth",
    "1",
    "https://github.com/wbthomason/packer.nvim",
    install_path,
  })
end
vim.api.nvim_command("packadd packer.nvim")
-- returns the require for use in `config` parameter of packer's use
-- expects the name of the config file
function get_setup(name)
  return string.format('require("setup/%s")', name)
end

return require("packer").startup({
  function(use)
    -- Packer can manage itself
    use({ "wbthomason/packer.nvim" })
    use({
      "nvim-telescope/telescope.nvim",
      module = "telescope",
      cmd = "Telescope",
      requires = {
        { "nvim-lua/plenary.nvim" },
        { "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
      },
      config = get_setup("telescope"),
    })
    use({ "nvim-telescope/telescope-file-browser.nvim" })
    use({ "stevearc/dressing.nvim" })
    if packer_bootstrap then
      require("packer").sync()
    end
  end,
  config = {
    display = {
      open_fn = require("packer.util").float,
    },
    profile = {
      enable = true,
      threshold = 1, -- the amount in ms that a plugins load time must be over for it to be included in the profile
    },
  },
})

And here is my cut down telescope config:

-- Telescope Global remapping
local action_state = require("telescope.actions.state")
local actions = require("telescope.actions")
local fb_actions = require("telescope._extensions.file_browser.actions")

require("telescope").setup({
  defaults = {
    winblend = 20,
    sorting_strategy = "descending",
    layout_strategy = "flex",
    layout_config = {
      flex = {
        flip_columns = 140,
      },
      vertical = {
        preview_cutoff = 40,
        prompt_position = "bottom",
      },
      horizontal = {
        width = 0.9,
        height = 0.8,
      },
    },
    mappings = {
      i = {
        ["<esc>"] = actions.close,
        ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
      },
    },
  },
  extensions = {
    file_browser = {
      theme = "ivy",
      mappings = {
        ["i"] = {
          ["<S-M>"] = fb_actions.move,
        },
      },
    },
  },
  pickers = {
    buffers = {
      sort_lastused = true,
      mappings = {
        i = {
          ["<C-w>"] = "delete_buffer",
        },
        n = {
          ["<C-w>"] = "delete_buffer",
        },
      },
    },
  },
})

require("telescope").load_extension("fzf")
require("telescope").load_extension("file_browser")

And I still see the problem. Wondering if this could be OS specific?? Don't really have much left to cut out.

@stevearc are you on macOS too or Linux/Win?

stevearc commented 2 years ago

When I tested this it was on linux, but I can take another look on my work mac tomorrow. You can try adding

require('dressing').setup({
  input = {
    override = function(conf)
      -- The default is 50. Try bumping it up until it's on top
      -- See :help nvim_open_win for details on zindex
      conf.zindex = 100
    end
  }
})

As mentioned that should fix the overlay rendering issue, but not sure what could be causing the focus problem. I'll try again tomorrow on the mac and see if that helps to replicate it.

stevearc commented 2 years ago

Just tried on the mac, with only the config that you listed here. Still seems to work fine ¯\(ツ)

benfrain commented 2 years ago

Bah! Even tried on a different machine and still the same for me. I’m stumped then.

I’ll close this as it must be something particular to my setup i haven’t figured. Thanks again for taking a look.

appelgriebsch commented 2 years ago

Stumbled across the same behaviour on my Neovim configuration, esp. when trying to copy or rename files in the file browser of telescope. Anyone made some progress on it already?

benfrain commented 2 years ago

Wonder if the terminal used might be relevant? I’m using Kitty, you?

appelgriebsch commented 2 years ago

iTerm2

benfrain commented 2 years ago

Hmm, seems unlikely to be that, then, although curious to know what @stevearc is using on mac?

stevearc commented 2 years ago

I was using Alacritty. I can give it another go with iTerm and see if that changes things

benfrain commented 2 years ago

Just to add this is now no longer a problem. I believe there was a problem with the Victor Mono Nerd Font in that the glyphs were not uniform; this was the cause of a different problem I was seeing in Telescope File Browser: https://github.com/nvim-telescope/telescope-file-browser.nvim/issues/157

Since changing font, that, and now this problem have resolved.