noice.nvim icon indicating copy to clipboard operation
noice.nvim copied to clipboard

misplaced completion window for certain commands

Open max397574 opened this issue 1 year ago • 5 comments

Describe the bug The completion window for commandline is at the wrong place with some commands (lowercase ones?).

Which version of Neovim are you using? NVIM v0.9.0-dev-77-gf175ca9f7

To Reproduce Steps to reproduce the behavior:

  1. nvim --clean -u minimal_noice.lua
  2. :Pack<tab>
  3. :checkhe<tab>

Screenshots Screenshot 2022-10-30 at 08 30 50

Screenshot 2022-10-30 at 08 31 02

Odd is that here there is an empty line between commandline and window which isn't the case with my normal config. But the bug is the same.

`minimal_noice.lua`
```lua
vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])
local package_root = "/tmp/nvim/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
    require("packer").startup({
        {
            "wbthomason/packer.nvim",
            {
                "folke/noice.nvim",
                requires = {
                    "MunifTanjim/nui.nvim",
                    "rcarriga/nvim-notify",
                },
            },
        },
        config = {
            package_root = package_root,
            compile_path = install_path .. "/plugin/packer_compiled.lua",
            display = { non_interactive = true },
        },
    })
end
_G.load_config = function()
    vim.o.lazyredraw = false
    require("noice").setup({
        cmdline = {
            enabled = true,
            ---@type table
            format = {
                search_down = {
                    kind = "Search",
                    pattern = "^/",
                    lang = "regex",
                    view = "cmdline",
                },
                inspect = {
                    conceal = true,
                    icon = "ï‘« ",
                    lang = "lua",
                    pattern = "^:%s*lua =%s*",
                    -- icon=" "
                },
            },
        },
        popupmenu = {
            enabled = true,
            ---@type 'nui'|'cmp'
            backend = "nui",
        },
        notiy = {
            enabled = true,
        },
        messages = {
            enabled = true,
        },
        lsp = {
            hover = {
                enabled = true,
            },
            progress = {
                enabled = false,
            },
            signature = {
                enabled = true,
            },
            message = {
                enabled = true,
            },
            override = {
                -- override the default lsp markdown formatter with Noice
                ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
                -- override the lsp markdown formatter with Noice
                ["vim.lsp.util.stylize_markdown"] = true,
            },
        },
        views = {
            cmdline_popup = {
                position = {
                    row = -2,
                    col = "50%",
                },
                size = {
                    width = math.floor(vim.o.columns * 0.9),
                    height = "auto",
                },
                win_options = {
                    conceallevel = 0,
                },
            },
            popupmenu = {
                -- relative = "editor",
                position = {
                    row = -5,
                    col = "50%",
                },
                size = {
                    width = math.floor(vim.o.columns * 0.9),
                    height = 10,
                },
                border = {
                    style = "rounded",
                    padding = { 0, 1 },
                },
                win_options = {
                    winhighlight = {
                        Normal = "Normal",
                        FloatBorder = "DiagnosticInfo",
                    },
                },
            },
        },
        routes = {
            {
                filter = {
                    event = "msg_show",
                    kind = "",
                    find = "written",
                },
                opts = { skip = true },
            },
        },
    })
end
if vim.fn.isdirectory(install_path) == 0 then
    print("Installing plugins 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 load_config()]]
)
```

max397574 avatar Oct 30 '22 07:10 max397574

I found some other cases where it fails (this is without minimal config now): :T<tab> Screenshot 2022-10-30 at 09 48 31

:TS<tab> Screenshot 2022-10-30 at 09 48 48

Interesting to see that it's at different places than in previous screenshots

max397574 avatar Oct 30 '22 08:10 max397574

Try disabling smart_move

folke avatar Oct 30 '22 09:10 folke

doesn't seem to fix it

max397574 avatar Oct 30 '22 09:10 max397574

it might has something to do with the negative numbers for the positions before I used positive ones and never had similar problems now I tried using absolute ones again and none of the issues above occured I'll have to see if I find a way to do it without negative ones

max397574 avatar Oct 30 '22 09:10 max397574

it's fixable with e.g. vim.o.lines-3 perhaps that could be internally when negative numbers are used?

max397574 avatar Oct 30 '22 09:10 max397574

It wasnt mentioned anywhere that negative numbers would work, so would have been very useful to mention that when opening an issue. Or not opening an issue at all since it's not documented anywhere.

Either way, I'll add support for this.

folke avatar Nov 07 '22 07:11 folke

My apologies. Apparently I had previously already implemented negative offsets 😄 Will look into it further!

folke avatar Nov 07 '22 13:11 folke

Should be fixed now!

folke avatar Nov 07 '22 13:11 folke