Bekaboo / dropbar.nvim

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

[Bug]: It only show one dropbar when using `diff-mode` #135

Closed ofseed closed 5 months ago

ofseed commented 5 months ago

Description

By start Neovim with:

nvim --clean -u minimal.lua -d file1.txt file2.txt

Only the right side will show dropbar. image

nvim version

NVIM v0.10.0-dev-2246+gf4b3636f2 Build type: Release LuaJIT 2.1.1706185428

dropbar.nvim version

9a8e498374276dd0281736c75b42098ef9fb5622

Operating system and version

Linux 5.15.133.1-microsoft-standard-WSL2 x86_64 GNU /Linux

Minimal config

local tmp = vim.env.TMPDIR
  or vim.env.TEMPDIR
  or vim.env.TMP
  or vim.env.TEMP
  or '/tmp'
local data = tmp ..  '/' .. (vim.env.NVIM_APPNAME or 'nvim')
local packages_root = data .. '/site'
local cloned_root = packages_root .. '/pack/packages/start'
local cloned_path = cloned_root .. '/dropbar.nvim'
local url = 'https://github.com/Bekaboo/dropbar.nvim.git'

vim.fn.mkdir(cloned_root, 'p')
vim.opt.pp:prepend(packages_root)
vim.opt.rtp:prepend(packages_root)

if not vim.loop.fs_stat(cloned_path) then
  vim.fn.system({ 'git', 'clone', url, cloned_path })
end

require('dropbar').setup()

Steps to reproduce

Same with the description.

Expected behavior

It should show dropbar on both sides of the window.

Actual behavior

dropbar only shows on the right side of the window.

Additional information

No response

Bekaboo commented 5 months ago

See opts.general, you can change opts.general.enable to attach winbar to buffer in diff mode:

function(buf, win)
  return not vim.api.nvim_win_get_config(win).zindex
  and vim.bo[buf].buftype == ''
  and vim.api.nvim_buf_get_name(buf) ~= ''
end
ofseed commented 5 months ago

I didn't expect that the defaults specifically prevent it from being displayed in the diff. I would like to inquire, what is the rationale behind this design?

Bekaboo commented 5 months ago

@ofseed It was (originally) intended to avoid exactly this case (winbar attaching to only one of the windows when multiple windows are in diff mode) but is now outdated. I will update the config and use a saner default function to determine whether we should attach dropbar to specific windows/buffers.