Skip to content

Bug: Branch component disappears on inactive windows #1440

@rnxden

Description

@rnxden

Self Checks

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

How to reproduce the problem

  1. Open Neovim inside a git repo
  2. Open any file (suppose first.txt)
  3. Open a different file (suppose second.txt)
  4. Create a split such that the window containing second.txt is inactive

Expected behaviour

The git branch component should not disappear.

Actual behaviour

The git branch component disappears.

Image

Note: The git branch component does not disappear when the first file opened is inactive, but will disappear when any further files opened are inactive.

Minimal config to reproduce the issue

-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  local lazyrepo = "https://github.com/folke/lazy.nvim.git"
  local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
  if vim.v.shell_error ~= 0 then
    vim.api.nvim_echo({
      { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
      { out, "WarningMsg" },
      { "\nPress any key to exit..." },
    }, true, {})
    vim.fn.getchar()
    os.exit(1)
  end
end
vim.opt.rtp:prepend(lazypath)

-- Lualine configuration
require("lazy").setup({
  spec = {
    {
      'nvim-lualine/lualine.nvim',
      config = {
        sections = {
          lualine_a = { 'filename', 'branch' },
          lualine_b = {},
          lualine_c = {},
          lualine_x = {},
          lualine_y = {},
          lualine_z = {},
        },
        inactive_sections = {
          lualine_a = { 'filename', 'branch' },
          lualine_b = {},
          lualine_c = {},
          lualine_x = {},
          lualine_y = {},
          lualine_z = {},
        },
      },
    },
  },
})

Additional information

I am willing to take on this issue. I will look into why this behavior occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions