Bekaboo / dropbar.nvim

IDE-like breadcrumbs, out of the box
GNU General Public License v3.0
1.05k stars 24 forks source link

[Bug]: Changing the bar separator clears out icons #31

Closed miversen33 closed 1 year ago

miversen33 commented 1 year ago

Description

I might be doing this incorrectly, but when I set the value of opts.icons.ui.bar.separator to some string, all icons disappear as well.

See below for an example

Dropbar config

require("dropbar").setup({
    icons = {
        ui = {
            bar = {
                separator = "  "
            }
        }
    }
})

nvim version

NVIM v0.10.0-dev-422+g68e2d7229

dropbar.nvim version

4ef2dac

Operating system and version

Arch Linux

Minimal config

-- Minimal configuration
-- mini.lua
-- Use with the --clean -u flags. EG nvim --clean -u mini.lua
-- This config will create a temp directory and will blow away that temp directory
-- everytime this configuration is loaded. Great for simulating a new installation
-- of a plugin

-- Setting some basic vim options
-- Some junk because I am sick of formatting tables in print
local _print = _G.print
local clean_string = function(...)
    local args = { n = select("#", ...), ... }
    local formatted_args = {}
    for i=1, args.n do
        local item = select(i, ...)
        if not item then item = 'nil' end
        local t_type = type(item)
        if t_type == 'table' or t_type == 'function' or t_type == 'userdata' then
            item = vim.inspect(item)
        end
        table.insert(formatted_args, item)
    end
    return table.concat(formatted_args, ' ')
end
_G.print = function(...)
    _print(clean_string(...))
end

vim.opt.mouse = 'a'
vim.opt.termguicolors = true
-- If you want to play around with this, you can set the do_clean
-- variable to false. This will allow changes made to
-- underlying plugins to persist between sessions, while
-- still keeping everything in its own directory so
-- as to not affect your existing neovim installation.
--
-- Setting this to true will result in a fresh clone of
-- all modules
local do_clean = true

local sep = vim.loop.os_uname().sysname:lower():match('windows') and '\\' or '/' -- \ for windows, mac and linux both use \

local mod_path = string.format("%s%sclean-test%s", vim.fn.stdpath('cache'), sep, sep)
if vim.loop.fs_stat(mod_path) and do_clean then
    print("Found previous clean test setup. Cleaning it out")
    -- Clearing out the mods directory and recreating it so 
    -- you have a fresh run everytime
    vim.fn.delete(mod_path, 'rf')
end

vim.fn.mkdir(mod_path, 'p')

local modules = {
    {"Bekaboo/dropbar.nvim"}
}

for _, module in ipairs(modules) do
    local repo = module[1]
    local branch = module.branch
    local module_name = repo:match('/(.*)')
    local module_path = string.format('%s%s%s', mod_path, sep, module_name)
    if not vim.loop.fs_stat(module_name) then
        -- The module doesn't exist, download it
        local cmd = {
            'git',
            'clone'
        }
        if branch then
            table.insert(cmd, '--branch')
            table.insert(cmd, branch)
        end
        table.insert(cmd, string.format('https://github.com/%s', repo))
        table.insert(cmd, module_path)
        vim.fn.system(cmd)
        local message = string.format("Downloaded %s", module_name)
        if branch then
            message = string.format("%s on branch %s", message, branch)
        end
        print(message)
    end
    vim.opt.runtimepath:append(module_path)
end

print("Finished installing plugins. Beginning Setup of plugins")

for _, module in ipairs(modules) do
    if module.mod then
        print(string.format("Loading %s", module.mod))
        local success, err = pcall(require, module.mod)
        if not success then
            print(string.format("Failed to load module %s", module.mod))
            error(err)
        end
    end
end

-- --> Do you module setups below this line <-- --

require("dropbar").setup({
    icons = {
        ui = {
            bar = {
                separator = "  "
            }
        }
    }

})

-- --> Do your module setups above this line <-- --
print("Completed minimal setup!")

Steps to reproduce

Change the separator (or I imagine anything within opts.ui)

Expected behavior

I am guessing what is happening is my provided table for opts.icons.ui.bar is being used wholesale instead of my changes being merged over the defaults. This results in dropbar not displaying anything for the items in the menu except the name and separator

Actual behavior

The icons for each item in the menu are gone

Additional information

I don't know if my above guess is correct, but if it is, its probably worth checking out :h vim.tbl_deep_extend to merge user provided config against the default. And if I am way off base, then I have no idea what is going on lol

Bekaboo commented 1 year ago

Thanks for your report! Please test if the latest commit fixes the issue.

miversen33 commented 1 year ago

You move so much faster than I do lol. The latest commit does indeed correct the issue :)

Bekaboo commented 1 year ago

Glad to know that! :D