aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/decorations_spec.lua
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-08-08 10:42:08 +0200
committerbfredl <bjorn.linse@gmail.com>2024-08-30 11:49:09 +0200
commitcfdf68a7acde16597fbd896674af68c42361102c (patch)
tree6113193fda7a7c0f94577a464e39964e74311583 /test/functional/ui/decorations_spec.lua
parent4353996d0fa8e5872a334d68196d8088391960cf (diff)
downloadrneovim-cfdf68a7acde16597fbd896674af68c42361102c.tar.gz
rneovim-cfdf68a7acde16597fbd896674af68c42361102c.tar.bz2
rneovim-cfdf68a7acde16597fbd896674af68c42361102c.zip
feat(mbyte): support extended grapheme clusters including more emoji
Use the grapheme break algorithm from utf8proc to support grapheme clusters from recent unicode versions. Handle variant selector VS16 turning some codepoints into double-width emoji. This means we need to use ptr2cells rather than char2cells when possible.
Diffstat (limited to 'test/functional/ui/decorations_spec.lua')
-rw-r--r--test/functional/ui/decorations_spec.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 1709819575..61a5e1d6f7 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -5620,6 +5620,27 @@ l5
]]
})
end)
+
+ it('supports emoji as signs', function()
+ insert(example_test3)
+ feed 'gg'
+ api.nvim_buf_set_extmark(0, ns, 1, 0, {sign_text='🧑‍🌾'})
+ -- VS16 can change width of character
+ api.nvim_buf_set_extmark(0, ns, 2, 0, {sign_text='❤️'})
+ api.nvim_buf_set_extmark(0, ns, 3, 0, {sign_text='❤'})
+ api.nvim_buf_set_extmark(0, ns, 4, 0, {sign_text='❤x'})
+ screen:expect([[
+ {7: }^l1 |
+ 🧑‍🌾l2 |
+ ❤️l3 |
+ ❤ l4 |
+ ❤xl5 |
+ {7: } |
+ {1:~ }|*3
+ |
+ ]])
+ eq("Invalid 'sign_text'", pcall_err(api.nvim_buf_set_extmark, 0, ns, 5, 0, {sign_text='❤️x'}))
+ end)
end)
describe('decorations: virt_text', function()