rebelot / heirline.nvim

Heirline.nvim is a no-nonsense Neovim Statusline plugin designed around recursive inheritance to be exceptionally fast and versatile.
MIT License
968 stars 38 forks source link

ViMode Update ModeChanged makes heirline crash on smaller terminal sizes #175

Open cronyakatsuki opened 7 months ago

cronyakatsuki commented 7 months ago

Recently I started using heirline and have seen that it sometimes crashes when my terminal windows is small in size.

Here is the crash ouput:

eirline.nvim/lua/heirline/statusline.lua:381: bad argument #1 to 'prov
ider' (string expected, got nil)
stack traceback:
        [C]: in function 'provider'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:38
1: in function '_eval'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:39
8: in function '_eval'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:39
8: in function '_eval'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:47
3: in function 'eval'
        ...ocal/share/nvim/lazy/heirline.nvim/lua/heirline/init.lua:10
9: in function <...ocal/share/nvim/lazy/heirline.nvim/lua/heirline/ini
t.lua:104>
        [C]: in function 'nvim_exec2'
        vim/_editor.lua: in function 'cmd'
        /home/crony/.config/nvim/lua/crony/plugins/heirline.lua:109: i
n function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>
stack traceback:
        [C]: in function 'nvim_exec2'
        vim/_editor.lua: in function 'cmd'
        /home/crony/.config/nvim/lua/crony/plugins/heirline.lua:109: i
n function ''

Here is a link to my current heirline config

Edit: The config is almost 100% just copy paste job from the wiki.

cronyakatsuki commented 7 months ago

After some playing around with the config, I have seen that by commenting out this block of code for ViMode component copied from the wiki fixed this issue.

      update = {
        "ModeChanged",
        pattern = "*:*",
        callback = vim.schedule_wrap(function()
          vim.cmd.redrawstatus()
        end),
      },

By commenting it out the ViMode component still works normally and doesn't throw the error when quiting neovim.

rebelot commented 1 week ago

see fix in #203