From a1304ea8b6c8d4695ead615662c0a977df17cf50 Mon Sep 17 00:00:00 2001 From: shadmansaleh Date: Sat, 5 Mar 2022 13:41:08 +0000 Subject: [PATCH] chore: autogen (vimdocs+formating) --- lua/lualine/components/tabs/tab.lua | 6 ++++-- lua/tests/spec/component_spec.lua | 12 +++++++----- lua/tests/statusline.lua | 8 ++++---- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lua/lualine/components/tabs/tab.lua b/lua/lualine/components/tabs/tab.lua index dbfdd4a..1d9e191 100644 --- a/lua/lualine/components/tabs/tab.lua +++ b/lua/lualine/components/tabs/tab.lua @@ -19,8 +19,10 @@ end --- of the tab. ---@return string function Tab:label() - local ok,custom_tabname = pcall(vim.api.nvim_tabpage_get_var, self.tabId, 'tabname') - if not ok then custom_tabname = nil end + local ok, custom_tabname = pcall(vim.api.nvim_tabpage_get_var, self.tabId, 'tabname') + if not ok then + custom_tabname = nil + end if custom_tabname and custom_tabname ~= '' then return modules.utils.stl_escape(custom_tabname) end diff --git a/lua/tests/spec/component_spec.lua b/lua/tests/spec/component_spec.lua index f5fbe84..85af284 100644 --- a/lua/tests/spec/component_spec.lua +++ b/lua/tests/spec/component_spec.lua @@ -568,7 +568,9 @@ describe('Branch component', function() local tmpdir local file local git = function(...) - return vim.fn.system("git -c user.name='asdf' -c user.email='asdf@jlk.org' -C " .. tmpdir .. ' ' .. string.format(...)) + return vim.fn.system( + "git -c user.name='asdf' -c user.email='asdf@jlk.org' -C " .. tmpdir .. ' ' .. string.format(...) + ) end local assert_comp_ins = helpers.assert_component_instence @@ -610,10 +612,10 @@ describe('Branch component', function() icons_enabled = false, padding = 0, } - git 'checkout -b test_branch2' - git 'commit --allow-empty -m "test commit1"' - git 'commit --allow-empty -m "test commit2"' - git 'commit --allow-empty -m "test commit3"' + git('checkout -b test_branch2') + git('commit --allow-empty -m "test commit1"') + git('commit --allow-empty -m "test commit2"') + git('commit --allow-empty -m "test commit3"') git('checkout HEAD~1') vim.cmd('e ' .. file) local rev = git('rev-parse --short=6 HEAD'):sub(1, 6) diff --git a/lua/tests/statusline.lua b/lua/tests/statusline.lua index 9970f76..f878e72 100644 --- a/lua/tests/statusline.lua +++ b/lua/tests/statusline.lua @@ -107,11 +107,11 @@ int build_stl_str_hl( local function process_hlrec(hltab, stlbuf, eval_type) local function default_hl() if eval_type == 'tabline' then - return "TabLineFill" + return 'TabLineFill' elseif eval_type == 'inactive' then - return "StatusLineNC" + return 'StatusLineNC' else - return "StatusLine" + return 'StatusLine' end end local len = #ffi.string(stlbuf) @@ -169,7 +169,7 @@ local function eval_stl(stl_expr, width, eval_type) if vim.fn.has('nvim-0.6') == 1 then stl_eval_res = vim.api.nvim_eval_statusline( stl_expr, - { maxwidth = width, highlights = true, fillchar = ' ', use_tabline = (eval_type == 'tabline')} + { maxwidth = width, highlights = true, fillchar = ' ', use_tabline = (eval_type == 'tabline') } ) else stl_eval_res = gen_stl(stl_expr, width, eval_type)