Skip to content

Commit

Permalink
barbar: use more precise strwidth api func when setting offset
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Jun 10, 2024
1 parent d7d7c03 commit 8eb7a50
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lua/nxvim/plugins/neo-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,13 @@ local neo_tree_win = {

local barbar_ok, barbar_api = pcall(require, "barbar.api")
local utils = require("nxvim.utils")
local spacer = (" "):rep(5)

local function set_offset()
if not barbar_ok then return end
local title = " 󰙅 " .. utils.truc_path(vim.fn.getcwd())
local space = neo_tree_win.width - title:len()
local filler = space > 0 and (" "):rep(space) or " "
barbar_api.set_offset(neo_tree_win.width + 2, title .. filler .. spacer)
local space = neo_tree_win.width - vim.api.nvim_strwidth(title)
local filler = space > 0 and (" "):rep(space) or ""
barbar_api.set_offset(neo_tree_win.width + 2, title .. filler)
end

config.event_handlers = {
Expand Down

0 comments on commit 8eb7a50

Please sign in to comment.