From 13f7147183cb9b231bce0342282d18be18a874e6 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Sat, 12 Mar 2022 18:32:37 +0600 Subject: [PATCH 1/5] chore: yank master -> develop (#235) Co-authored-by: Lukas Reineke From 2b6ff213d777419859118850b8c48064fad29446 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Thu, 17 Mar 2022 11:59:43 +0600 Subject: [PATCH 2/5] fix: clear autocmds when clearing generator state (#236) --- lua/feline/generator.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/feline/generator.lua b/lua/feline/generator.lua index f46617f..324f8d1 100644 --- a/lua/feline/generator.lua +++ b/lua/feline/generator.lua @@ -345,7 +345,7 @@ local function parse_provider(provider, component, is_short, winid, section_nr, component_nr ), }, - }, 'feline', true) + }, 'felineProviders', true) end end @@ -643,6 +643,11 @@ function M.clear_state() provider_cache = {} short_provider_cache = {} provider_autocmd = {} + -- Clear provider update autocmds + if vim.fn.exists('#felineProviders') ~= 0 then + api.nvim_command('autocmd! felineProviders') + api.nvim_command('augroup! felineProviders') + end end return M From 293a3de450758030d7ababea205643113f7113ce Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Fri, 18 Mar 2022 07:07:17 +0600 Subject: [PATCH 3/5] fix: use correct maximum width for global statusline (#237) --- lua/feline/generator.lua | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lua/feline/generator.lua b/lua/feline/generator.lua index 324f8d1..0d7cb13 100644 --- a/lua/feline/generator.lua +++ b/lua/feline/generator.lua @@ -1,5 +1,6 @@ local bo = vim.bo local api = vim.api +local opt = vim.opt local feline = require('feline') local utils = require('feline.utils') @@ -545,10 +546,18 @@ function M.generate_statusline(is_active) end end - local window_width = api.nvim_win_get_width(0) + local maxwidth - -- If statusline width is greater than the window width, begin the truncation process - if statusline_width > window_width then + -- If statusline is global, use entire Neovim window width for maxwidth + -- Otherwise just use width of current window + if opt.laststatus:get() == 3 then + maxwidth = opt.columns:get() + else + maxwidth = api.nvim_win_get_width(0) + end + + -- If statusline width is greater than maxwidth, begin the truncation process + if statusline_width > maxwidth then -- First, sort the component indices in ascending order of the priority of the components -- that the indices refer to table.sort(component_indices, function(first, second) @@ -594,7 +603,7 @@ function M.generate_statusline(is_active) end end - if statusline_width <= window_width then + if statusline_width <= maxwidth then break end end @@ -602,7 +611,7 @@ function M.generate_statusline(is_active) -- If statusline still doesn't fit within window, remove components with truncate_hide set to -- true until it does - if statusline_width > window_width then + if statusline_width > maxwidth then for _, indices in ipairs(component_indices) do local section, number = indices[1], indices[2] local component = sections[section][number] @@ -618,7 +627,7 @@ function M.generate_statusline(is_active) end end - if statusline_width <= window_width then + if statusline_width <= maxwidth then break end end From 3f83d219e9bf21e6f462af5ad86af179fee89c16 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Fri, 18 Mar 2022 14:03:03 +0600 Subject: [PATCH 4/5] docs: update USAGE.md (#238) --- USAGE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/USAGE.md b/USAGE.md index 73456ee..fbdc0cb 100644 --- a/USAGE.md +++ b/USAGE.md @@ -204,9 +204,9 @@ Two components inside the `active` or `inactive` table cannot share the same nam #### Truncation -Feline has an automatic smart truncation system where components can be automatically truncated if the statusline doesn't fit within the window. It can be useful if you want to make better use of screen space. It also allows you to better manage which providers are truncated, how they are truncated and in which order they are truncated. +Feline has an automatic smart truncation system where components can be automatically truncated if the statusline doesn't fit within the available space. It can be useful if you want to make better use of screen space. It also allows you to better manage which providers are truncated, how they are truncated and in which order they are truncated. -**NOTE:** Truncation currently only works with the master branch of Neovim. If you're using a stable release, truncation will not work and all configurations related to it will be silently ignored. +**NOTE:** Truncation only works on Neovim 0.6 and above. If you're using an earlier release, truncation will not work and all configurations related to it will be silently ignored. There are a few component values associated with truncation which are described below. From b13f25e5e401b95ea09afc9223670048697740f0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 18 Mar 2022 14:04:29 +0600 Subject: [PATCH 5/5] chore: generated vimdoc (#239) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- doc/feline.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/feline.txt b/doc/feline.txt index 62c89ac..ef045a7 100644 --- a/doc/feline.txt +++ b/doc/feline.txt @@ -301,17 +301,17 @@ Truncation Feline has an automatic smart truncation system where components can be automatically truncated if the statusline doesn’t fit within the - window. It can be useful if you want to - make better use of screen space. It also - allows you to better manage which - providers are truncated, how they are - truncated and in which order they are - truncated. + available space. It can be useful if you + want to make better use of screen space. + It also allows you to better manage + which providers are truncated, how they + are truncated and in which order they + are truncated. -**NOTE:** Truncation currently only works with the master branch of Neovim. If -you’re using a stable release, truncation will not work and all -configurations related to it will be silently ignored. +**NOTE:** Truncation only works on Neovim 0.6 and above. If you’re using an +earlier release, truncation will not work and all configurations related to it +will be silently ignored. There are a few component values associated with truncation which are described below.