From aa844a955504c6f5fda3f7fe4e15c3d215b5b8c3 Mon Sep 17 00:00:00 2001 From: Shadman Date: Tue, 13 Apr 2021 23:09:01 +0600 Subject: [PATCH] BugFix: Fix function component not working (#175) When the provided function takes an optional argument the previous implementation causes error. --- lua/lualine/components/special/functon_component.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/lualine/components/special/functon_component.lua b/lua/lualine/components/special/functon_component.lua index 820d566..e18f26f 100644 --- a/lua/lualine/components/special/functon_component.lua +++ b/lua/lualine/components/special/functon_component.lua @@ -1,9 +1,8 @@ local FunctionComponent = require('lualine.component'):new() -FunctionComponent.new = function(self, options, child) - local new_instence = self._parent:new(options, child or FunctionComponent) - new_instence.update_status = options[1] - return new_instence +FunctionComponent.update_status = function(self) + -- 1st element in options table is the function provided by config + return self.options[1]() end return FunctionComponent