rebelot/heirline.nvim

Two statusline when restoring session if I use Tabpage on the statusline.

Closed this issue · 8 comments

isaif commented

I am using "Tabpage" to show tabs on the statusline. It works well but on session restore it shows two statuslines if I navigate to another tab.

image

How it looks when a session is restored which had two or more tabs and I navigate to another tab.

image

Now if I close all other tabs on this restored session and open a new tab then again it starts to work well.

Here is the minimal config for the heirline with only tabs on the statusline:

return {
  'rebelot/heirline.nvim',
  dependencies = {
  },
  config = function()
    local heirline = require('heirline')
    local utils = require('heirline.utils')

    local Tabpage = {
      provider = function(self)
        return '%' .. self.tabnr .. 'T ' .. self.tabpage .. ' %T'
      end,
      hl = function(self)
        if not self.is_active then
          return 'TabLine'
        else
          return 'TabLineSel'
        end
      end,
    }

    local TabPages = {
      condition = function()
        return #vim.api.nvim_list_tabpages() >= 2
      end,
      { provider = '%=' },
      utils.make_tablist(Tabpage),
    }

    local StatusLine = {
      TabPages,
    }

    heirline.setup({ statusline = StatusLine })
  end,
}

Session options:

opt.sessionoptions = {
  'blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions',
}

Neovim version:

NVIM v0.10.0-dev-19+g339011f59
Build type: Release
LuaJIT 2.1.0-beta3

I am using https://github.com/rmagatti/auto-session for session management and using lazy.nvim for package management.

I don't know if it is the right way to show tabs on the statusline.

Thanks for making this awesome plugin.

Does the issue still happen without the session plugin?

isaif commented

No, I doesn't happen. The issue occurs only on a restored session.

I mean, can you try saving and restoring a session without the plugin?

I cannot reproduce with your config and vanilla :mksession, besides, I've never seen a statusline glitching across multiple lines... are you using any other ui plugin like noice?

isaif commented

Yes, I am using noice. That makes sense, I will disable noice and report back. Thanks.

isaif commented

Disabling noice solved the issue. Is there any solution to keep using noice with heirline?

No idea, I guess you should open an issue at noice, maybe there's some post sessionload hooks that might help redrawing/resetting the statusline

isaif commented

I managed to solve it by removing "blank" from sessionoptions. Now I can use both noice and heirline.

opt.sessionoptions = {
  'buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions',
}

Thanks for your time and help.