fix(nvim): fix black float backgrounds and guarantee abook 24-line height

- Add winhighlight=Normal:Normal to all floats so they inherit the
  colorscheme background instead of showing NormalFloat (black)
- Pin abook to min 24 lines; mail/calendar split the remaining height

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
Amir Alexander Abdelbaki 2026-05-26 12:08:20 +02:00
parent 890cb8819b
commit 766cfc0f8f
1 changed files with 14 additions and 12 deletions

View File

@ -179,14 +179,15 @@ end
local function _pim_float(row, col, height, width, border) local function _pim_float(row, col, height, width, border)
local buf = vim.api.nvim_create_buf(false, true) local buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_open_win(buf, true, { vim.api.nvim_open_win(buf, true, {
relative = "editor", relative = "editor",
row = row, row = row,
col = col, col = col,
height = math.max(1, height), height = math.max(1, height),
width = math.max(1, width), width = math.max(1, width),
style = "minimal", style = "minimal",
border = border or "none", border = border or "none",
zindex = 50, zindex = 50,
winhighlight = "Normal:Normal,NormalNC:Normal",
}) })
return vim.api.nvim_get_current_win() return vim.api.nvim_get_current_win()
end end
@ -232,10 +233,11 @@ local function toggle_pim()
local H = vim.o.lines - 2 local H = vim.o.lines - 2
local col_w = math.min(vim.o.columns, math.max(90, math.floor(vim.o.columns * 0.45))) local col_w = math.min(vim.o.columns, math.max(90, math.floor(vim.o.columns * 0.45)))
-- divide column height: mail 40%, calendar 30%, abook remainder (≥ 10) -- abook gets a fixed 24-line minimum; mail/calendar split the rest 57/43
local mail_h = math.max(1, math.floor(H * 0.40)) local ab_h = math.max(24, math.floor(H * 0.30))
local cal_h = math.max(1, math.floor(H * 0.30)) local rest = math.max(2, H - ab_h)
local ab_h = math.max(1, H - mail_h - cal_h) local mail_h = math.max(1, math.floor(rest * 0.57))
local cal_h = math.max(1, rest - mail_h)
local w1 = _pim_float(0, 0, mail_h, col_w) local w1 = _pim_float(0, 0, mail_h, col_w)
local ok, err = pcall(vim.cmd, "terminal alot") local ok, err = pcall(vim.cmd, "terminal alot")