From d5002d95a1d3de37f4aa967dff1c77cefa2605d9 Mon Sep 17 00:00:00 2001 From: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> Date: Wed, 6 Jul 2022 20:36:07 +0600 Subject: [PATCH] fix: reuse component ids while reloading all components fixes #722 --- lua/lualine/component.lua | 3 +++ lua/lualine/utils/loader.lua | 1 + 2 files changed, 4 insertions(+) diff --git a/lua/lualine/component.lua b/lua/lualine/component.lua index 0432832..8b92a4b 100644 --- a/lua/lualine/component.lua +++ b/lua/lualine/component.lua @@ -6,6 +6,9 @@ local M = require('lualine.utils.class'):extend() -- Used to provide a unique id for each component local component_no = 1 +function M._reset_component_id() + component_no = 1 +end -- variable to store component output for manipulation M.status = '' diff --git a/lua/lualine/utils/loader.lua b/lua/lualine/utils/loader.lua index 6a2893c..45ce2de 100644 --- a/lua/lualine/utils/loader.lua +++ b/lua/lualine/utils/loader.lua @@ -202,6 +202,7 @@ end ---loads sections and extensions or entire user config ---@param config table user config local function load_all(config) + require'lualine.component'._reset_component_id() load_components(config) load_extensions(config) end