Skip to content

Commit 6b93d15

Browse files
committed
perf: do not redraw the stl when on a floating win
Problem: Fzf-lua is slow since when scrolling to each result item Bareline redraws the statusline many times. Solution: When the cursor is on any floating window, do not redraw the statusline.
1 parent 18b7eb1 commit 6b93d15

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lua/bareline.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,9 +1162,19 @@ function h.is_plugin_window(bufnr)
11621162
and not vim.tbl_contains(special_non_plugin_filetypes, filetype)
11631163
end
11641164

1165+
---@param win_id integer
1166+
---@return boolean
1167+
function h.is_win_floating(win_id)
1168+
-- See |api-floatwin| to learn how to check whether a win is floating.
1169+
return vim.api.nvim_win_get_config(win_id).relative ~= ""
1170+
end
1171+
11651172
---@param statusline BareStatusline
11661173
---@param var_name string?
11671174
function h.draw_window_statusline(statusline, var_name)
1175+
if h.is_win_floating(0) then
1176+
return
1177+
end
11681178
local built_statusline = h.build_statusline(statusline, var_name)
11691179
vim.wo.statusline = built_statusline
11701180
h.log(built_statusline)

0 commit comments

Comments
 (0)