feat: redraw tabline

This commit is contained in:
Otávio Schwanck dos Santos 2023-05-18 18:15:03 +01:00
parent 8cb54c4003
commit fef97d4439
2 changed files with 16 additions and 2 deletions

View file

@ -11,10 +11,17 @@ local callbacks = {}
-- need one event emitted
local function emit_changed()
log.trace("_emit_changed()")
if harpoon.get_global_settings().save_on_change then
local global_settings = harpoon.get_global_settings()
if global_settings.save_on_change then
harpoon.save()
end
if global_settings.tabline then
vim.cmd("redrawt")
end
if not callbacks["changed"] then
log.trace("_emit_changed(): no callbacks for 'changed', returning")
return

View file

@ -39,7 +39,14 @@ function M.setup(opts)
for i, tab in ipairs(original_tabs) do
local is_current = string.match(vim.fn.bufname(), tab.filename) or vim.fn.bufname() == tab.filename
local label = tabs[i].filename
local label
if tabs[i].filename == "" or tabs[i].filename == "(empty)" then
label = "(empty)"
is_current = false
else
label = tabs[i].filename
end
if is_current then