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

Bug: Not enough room #872

Open
2 tasks done
augustocdias opened this issue Oct 19, 2022 · 2 comments
Open
2 tasks done

Bug: Not enough room #872

augustocdias opened this issue Oct 19, 2022 · 2 comments
Labels
bug Something isn't working upstream

Comments

@augustocdias
Copy link

Self Checks

  • I'm using the latest lualine.
  • I didn't find the issue in exsisting issues or prs.

How to reproduce the problem

Place a cursor on a block which the matching closing or opening is out of the viewport (ex: { and the matching } is out of the viewport) and press %

Expected behaviour

No error shown and I can navigate to the matching block.

Actual behaviour

This error is shown:

Error executing vim.schedule lua callback: ...acker/start/lualine.nvim/lua/lualine/utils/nvim_opts.lua:77: Vim:E36: Not enough room
stack traceback:
	[C]: in function 'nvim_win_set_option'
	...acker/start/lualine.nvim/lua/lualine/utils/nvim_opts.lua:77: in function 'setter_fn'
	...acker/start/lualine.nvim/lua/lualine/utils/nvim_opts.lua:50: in function 'set_opt'
	...acker/start/lualine.nvim/lua/lualine/utils/nvim_opts.lua:74: in function 'set'
	...nvim/site/pack/packer/start/lualine.nvim/lua/lualine.lua:433: in function 'refresh'
	...nvim/site/pack/packer/start/lualine.nvim/lua/lualine.lua:343: in function <...nvim/site/pack/packer/start/lualine.nvim/lua/lualine.lua:342>⏎

Minimal config to reproduce the issue

minimal.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',
            'nvim-lualine/lualine.nvim',
            'SmiteshP/nvim-gps',
            { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' },
            'nvim-treesitter/nvim-treesitter-context',
            'andymass/vim-matchup',
        },
        config = {
            package_root = package_root,
            compile_path = install_path .. '/plugin/packer_compiled.lua',
            display = { non_interactive = true },
        },
    })
end

vim.g.matchup_matchparen_offscreen = { method = 'popup' }
vim.g.matchup_transmute_enabled = true
_G.load_config = function()
    require('nvim-treesitter.configs').setup({
        -- A list of parser names, or "all"
        ensure_installed = { 'lua' },
        matchup = {
            enable = true,
        },
    })
    require('treesitter-context').setup({
        enable = true,
        max_lines = 0,
    })
    local gps = require('nvim-gps')
    gps.setup()

    local lualine = require('lualine')

    lualine.setup({
        options = {
            icons_enabled = true,
            theme = 'auto',
            section_separators = { left = '', right = '' },
            component_separators = { left = '', right = '' },
            disabled_filetypes = {},
            globalstatus = true,
        },
        sections = {
            lualine_a = { 'mode' },
            lualine_b = { 'diff', 'branch' },
            lualine_c = {
                {
                    'filename',
                    file_status = true, -- displays file status (readonly status, modified status)
                    path = 1, -- 0 = just filename, 1 = relative path, 2 = absolute path
                },
            },
            lualine_x = {
                'encoding',
                'filetype',
                {
                    'diagnostics',
                    sources = { 'nvim_diagnostic' },
                    symbols = { error = '', warn = '', info = '', hint = '' },
                    diagnostics_color = {
                        error = 'DiagnosticError',
                        warn = 'DiagnosticWarn',
                        info = 'DiagnosticInfo',
                        hint = 'DiagnosticHint',
                    },
                    always_visible = true,
                },
            },
            lualine_y = {
                'progress',
            },
            lualine_z = {
                'location',
            },
        },
        inactive_sections = {
            lualine_a = {},
            lualine_b = {},
            lualine_c = {
                {
                    'filename',
                    file_status = true, -- displays file status (readonly status, modified status)
                    path = 1, -- 0 = just filename, 1 = relative path, 2 = absolute path
                },
            },
            lualine_x = { 'location' },
            lualine_y = {},
            lualine_z = {},
        },
        winbar = {
            lualine_a = {},
            lualine_b = {},
            lualine_c = {
                { gps.get_location },
                {
                    'filename',
                    file_status = true, -- displays file status (readonly status, modified status)
                    path = 1, -- 0 = just filename, 1 = relative path, 2 = absolute path
                },
            },
            lualine_x = { 'location' },
            lualine_y = {},
            lualine_z = {},
        },
        tabline = {},
        extensions = { 'quickfix', 'nvim-tree', 'fzf' },
    })
end
if vim.fn.isdirectory(install_path) == 0 then
    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()]])
@augustocdias augustocdias added the bug Something isn't working label Oct 19, 2022
@shadmansaleh
Copy link
Member

shadmansaleh commented Oct 19, 2022

Thanks for making a proper issue. It's an upstream bug. You can follow neovim/neovim#19464

@isaksamsten
Copy link

Stumbled upon this issue. My workaround:

            {
              "filename",
              path = 1,
              fmt = function(filename)
                -- Small attempt to workaround https://github.com/nvim-lualine/lualine.nvim/issues/872
                if #filename > 80 then
                  filename = vim.fs.basename(filename)
                end

                if #filename > 80 then
                  return string.sub(filename, #filename - 80, #filename)
                end
                return filename
              end,
            },

If someone has the same issue while waiting for the upstream to be fixed.

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

No branches or pull requests

3 participants