diff --git a/lua/lualine.lua b/lua/lualine.lua index bf76511..49e38a1 100644 --- a/lua/lualine.lua +++ b/lua/lualine.lua @@ -82,7 +82,7 @@ local function fill_section_separator(status, is_focused, str_checked, last_hl, end --- processes statusline string ---- replaces %s/S{sep} with proper left/right separator highlight + sep +--- replaces %z/Z{sep} with proper left/right separator highlight + sep ---@param status string : unprocessed statusline string ---@return string : processed statusline string local function apply_transitional_separators(status, is_focused) @@ -93,7 +93,7 @@ local function apply_transitional_separators(status, is_focused) local copied_pos = 1 -- Tracks how much we've copied over to status_applied local str_checked = 1 -- Tracks where the searcher head is at - -- Process entire status replace the %s{sep} & %S{sep} placeholders + -- Process entire status replace the %z{sep} & %Z{sep} placeholders -- with proper transitional separator. while str_checked ~= nil do str_checked = status:find('%%', str_checked) @@ -108,9 +108,9 @@ local function apply_transitional_separators(status, is_focused) -- %#hl_name# highlights last_hl = status:match('^%%#(.-)#', str_checked) str_checked = str_checked + #last_hl + 3 - elseif next_char == 's' then - -- %s{sep} is marker for left separator and - local sep = status:match('^%%s{(.-)}', str_checked) + elseif next_char == 'z' then + -- %z{sep} is marker for left separator and + local sep = status:match('^%%z{(.-)}', str_checked) str_checked = str_checked + #sep + 4 -- 4 = len(%{}) if not (last_hl == nil and last_hl_reseted) then local trans_sep = fill_section_separator(status, is_focused, str_checked, last_hl, sep, false) @@ -122,11 +122,11 @@ local function apply_transitional_separators(status, is_focused) last_hl_reseted = false end copied_pos = str_checked - elseif next_char == 'S' then - -- %S{sep} is marker for right separator and - local sep = status:match('^%%S{(.-)}', str_checked) + elseif next_char == 'Z' then + -- %Z{sep} is marker for right separator and + local sep = status:match('^%%Z{(.-)}', str_checked) str_checked = str_checked + #sep + 4 -- 4 = len(%{}) - if status:find('^%%s', str_checked) or status:find('^%%<%%s', str_checked) then + if status:find('^%%z', str_checked) or status:find('^%%<%%Z', str_checked) then -- When transitional right_sep and left_sep are right next to each other -- and in this exact order skip the left sep as we can't draw both. str_checked = status:find('}', str_checked) + 1 diff --git a/lua/lualine/component.lua b/lua/lualine/component.lua index cb93dc7..a42f589 100644 --- a/lua/lualine/component.lua +++ b/lua/lualine/component.lua @@ -193,11 +193,11 @@ function M:apply_section_separators() return end if self.options.separator.left ~= nil and self.options.separator.left ~= '' then - self.status = string.format('%%s{%s}%s', self.options.separator.left, self.status) + self.status = string.format('%%z{%s}%s', self.options.separator.left, self.status) self.strip_previous_separator = true end if self.options.separator.right ~= nil and self.options.separator.right ~= '' then - self.status = string.format('%s%%S{%s}', self.status, self.options.separator.right) + self.status = string.format('%s%%Z{%s}', self.status, self.options.separator.right) end end diff --git a/lua/lualine/components/buffers/buffer.lua b/lua/lualine/components/buffers/buffer.lua index d5a5a23..c58c320 100644 --- a/lua/lualine/components/buffers/buffer.lua +++ b/lua/lualine/components/buffers/buffer.lua @@ -103,7 +103,7 @@ end ---@return string function Buffer:separator_before() if self.current or self.aftercurrent then - return '%S{' .. self.options.section_separators.left .. '}' + return '%Z{' .. self.options.section_separators.left .. '}' else return self.options.component_separators.left end @@ -113,7 +113,7 @@ end ---@return string function Buffer:separator_after() if self.current or self.beforecurrent then - return '%s{' .. self.options.section_separators.right .. '}' + return '%z{' .. self.options.section_separators.right .. '}' else return self.options.component_separators.right end diff --git a/lua/lualine/components/tabs/tab.lua b/lua/lualine/components/tabs/tab.lua index 8b76861..8ccdc90 100644 --- a/lua/lualine/components/tabs/tab.lua +++ b/lua/lualine/components/tabs/tab.lua @@ -91,7 +91,7 @@ end ---@return string function Tab:separator_before() if self.current or self.aftercurrent then - return '%S{' .. self.options.section_separators.left .. '}' + return '%Z{' .. self.options.section_separators.left .. '}' else return self.options.component_separators.left end @@ -101,7 +101,7 @@ end ---@return string function Tab:separator_after() if self.current or self.beforecurrent then - return '%s{' .. self.options.section_separators.right .. '}' + return '%z{' .. self.options.section_separators.right .. '}' else return self.options.component_separators.right end diff --git a/lua/lualine/utils/section.lua b/lua/lualine/utils/section.lua index 1521a02..57a309b 100644 --- a/lua/lualine/utils/section.lua +++ b/lua/lualine/utils/section.lua @@ -48,7 +48,7 @@ function M.draw_section(section, section_name, is_focused) and (section[1].options.section_separators.left ~= nil and section[1].options.section_separators.left ~= '') then status[component_no] = - string.format('%s%%S{%s}', status[component_no], section[1].options.section_separators.left) + string.format('%s%%Z{%s}', status[component_no], section[1].options.section_separators.left) end end end @@ -89,7 +89,7 @@ function M.draw_section(section, section_name, is_focused) and (section[1].options.section_separators.right ~= nil and section[1].options.section_separators.right ~= '') then left_separator_string = string.format( - '%%s{%s}', + '%%z{%s}', section[first_component_no].options.ls_separator or section[1].options.section_separators.right ) end @@ -104,7 +104,7 @@ function M.draw_section(section, section_name, is_focused) local needs_hl - local find_start_trans_sep_start, find_start_trans_sep_end = status_str:find('^%%s{.-}') + local find_start_trans_sep_start, find_start_trans_sep_end = status_str:find('^%%z{.-}') if find_start_trans_sep_start then -- the section doesn't need to be prepended with default hl when sections -- first component has transitional sep