folke / noice.nvim

💥 Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.
Apache License 2.0
3.95k stars 88 forks source link

bug: Borderless cmdline popups #866

Closed Chaitanyabsprip closed 2 weeks ago

Chaitanyabsprip commented 2 weeks ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.11.0-dev-20a7eeb

Operating system/version

archlinux 6.9.4-arch1-1

Describe the bug

With the commit 4c1efad, my existing configuration (also the configuration recipe for clean cmdline_popup) for noice.nvim started throwing errors for cmdline_popup views. The following error was thrown

....local/share/nvim/lazy/nui.nvim/lua/nui/popup/border.lua:686: text not supported for style:none

The issue is because you're setting the prompt as the popup title and nui.nvim doesn't support border text with border.style = 'none'.

Steps To Reproduce

Install noice.nvim with the provided configuration and run the command lua vim.fn.input { prompt = '>' }.

Expected Behavior

The text should either be still shown as part of the prompt or there needs to be better handling upstream. You could also just ignore the prompt text, but that would be a radical solution.

Repro

-- DO NOT change the paths and don't remove the colorscheme
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 = {
    'folke/tokyonight.nvim',
    {
        'folke/noice.nvim',
        dependencies = {
            'MunifTanjim/nui.nvim',
        },
        opts = {
            views = { cmdline_popup = { border = { style = 'none', padding = { 1, 1 } } } },
        },
    },
}
require('lazy').setup(plugins, {
    root = root .. '/plugins',
})

vim.cmd.colorscheme 'tokyonight'
-- add anything else here
b0ae989c commented 2 weeks ago

This is not a bug. nui does not support border.style = 'none' for popup window. See https://github.com/MunifTanjim/nui.nvim/issues/290#issuecomment-1641413627. Should close.

Chaitanyabsprip commented 2 weeks ago

I realize it's not a bug of nui.nvim, It is a bug in how noice.nvim is setting up the options for nui.nvim. see https://github.com/folke/noice.nvim/blob/4c1efadccc5d4568e3abf0afdd3ee0c5c27b4be9/lua/noice/view/nui.lua#L61

this line makes noice break for me, it doesn't check for style == 'none' or handle that case in any manner, if I checkout the commit before this change, it works great

sleeptightAnsiC commented 2 weeks ago

This is a regression in noice.nvim

Roll-backing to 29c7f030b0920e2f17263a9ab8742cde144b9140 (4.0.1) fixes this for me (temporary ofc).

Roll-backing to b828b575805f1b303c2f4b768744609835140739 (4.1.0) should also work, unless you're using a custom position for cmdline_popup since 07e8f9c7dfb01405f8b1173f1d3939b41753779d changed how said position is being handled (which seems it was later fixed in e55ce94a1e4b1b5388e11965072e0cde129604bd).

folke commented 2 weeks ago

input uses the cmdline_input view which extends from cmdline_popup. I just pushed a change that now always makes sure cmdline_input has a border.

If you don't want that, you need to change the view used by cmdline input. (see config)