From 8eb7a506369b4f30882dbe1656b6f197da619800 Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Mon, 10 Jun 2024 14:44:08 +0200 Subject: [PATCH] barbar: use more precise strwidth api func when setting offset --- lua/nxvim/plugins/neo-tree.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/nxvim/plugins/neo-tree.lua b/lua/nxvim/plugins/neo-tree.lua index 9341ee3..4230231 100644 --- a/lua/nxvim/plugins/neo-tree.lua +++ b/lua/nxvim/plugins/neo-tree.lua @@ -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 = {