fix(alpha): account for different icon byte sizes (#4130)

* fix(alpha): account for different icon byte sizes

* chore: format
This commit is contained in:
LostNeophyte 2023-05-06 17:46:26 +02:00 committed by GitHub
parent e9fbb801fb
commit 9efe4f25c3
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,6 +36,9 @@ local function resolve_buttons(theme_name, button_section)
-- this became necessary after recent changes in alpha.nvim (06ade3a20ca9e79a7038b98d05a23d7b6c016174)
button_element.on_press = on_press
-- account for different icon byte sizes in cursor offset
local _, icon_length = button_element.val:find "[\128-\255]*"
button_element.opts.cursor = icon_length + 2
button_element.opts = vim.tbl_extend("force", button_element.opts, entry[4] or button_section.opts or {})
table.insert(val, button_element)