Prechádzať zdrojové kódy

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

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

* chore: format
LostNeophyte 2 rokov pred
rodič
commit
9efe4f25c3
1 zmenil súbory, kde vykonal 3 pridanie a 0 odobranie
  1. 3 0
      lua/lvim/core/alpha.lua

+ 3 - 0
lua/lvim/core/alpha.lua

@@ -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)