Skip to content
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

misplaced completion window for certain commands #179

Closed
max397574 opened this issue Oct 30, 2022 · 8 comments · Fixed by #639
Closed

misplaced completion window for certain commands #179

max397574 opened this issue Oct 30, 2022 · 8 comments · Fixed by #639
Labels
bug Something isn't working

Comments

@max397574
Copy link
Contributor

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 max397574 added the bug Something isn't working label Oct 30, 2022
@max397574
Copy link
Contributor Author

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

@folke
Copy link
Owner

folke commented Oct 30, 2022

Try disabling smart_move

@max397574
Copy link
Contributor Author

doesn't seem to fix it

@max397574
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@folke
Copy link
Owner

folke commented Nov 7, 2022

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 folke closed this as completed in 8d7a63c Nov 7, 2022
@folke
Copy link
Owner

folke commented Nov 7, 2022

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

@folke folke reopened this Nov 7, 2022
@folke folke closed this as completed in cf2912d Nov 7, 2022
@folke
Copy link
Owner

folke commented Nov 7, 2022

Should be fixed now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants