From 304253e4c637fd5fc92cbc50707993130615808a Mon Sep 17 00:00:00 2001 From: bhagwan Date: Mon, 16 Dec 2024 13:21:37 -0800 Subject: [PATCH] fix: border scrollbar with `termguicolors` (closes #1571) --- lua/fzf-lua/win.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lua/fzf-lua/win.lua b/lua/fzf-lua/win.lua index 92086a833..243a510ee 100644 --- a/lua/fzf-lua/win.lua +++ b/lua/fzf-lua/win.lua @@ -533,9 +533,17 @@ function FzfWin:new(o) local hlgroup = "FzfLuaScrollBorderBackCompat" self.hls.scrollfloat_f = hlgroup if utils.__HAS_NVIM_07 then - vim.api.nvim_set_hl(0, hlgroup, { default = false, fg = bg, bg = fg }) + vim.api.nvim_set_hl(0, hlgroup, + vim.o.termguicolors and { default = false, fg = bg, bg = fg } + or { default = false, ctermfg = tonumber(bg), ctermbg = tonumber(fg) }) else - vim.cmd(string.format("hi! %s guifg=%s guibg=%s", hlgroup, bg, fg)) + if vim.o.termguicolors then + vim.cmd(string.format("hi! %s guifg=%s guibg=%s", hlgroup, bg, fg)) + else + vim.cmd(string.format("hi! %s %s %s", hlgroup, + tonumber(bg) and "ctermfg=" .. tostring(bg), + tonumber(fg) and "ctermbg=" .. tostring(fg))) + end end end end