aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/multibyte_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui/multibyte_spec.lua')
-rw-r--r--test/functional/ui/multibyte_spec.lua122
1 files changed, 113 insertions, 9 deletions
diff --git a/test/functional/ui/multibyte_spec.lua b/test/functional/ui/multibyte_spec.lua
index dc25a09d0d..f16f750ea1 100644
--- a/test/functional/ui/multibyte_spec.lua
+++ b/test/functional/ui/multibyte_spec.lua
@@ -296,6 +296,86 @@ describe('multibyte rendering', function()
]],
}
end)
+
+ it('supports emoji with variant selectors and ZWJ', function()
+ command('set ruler')
+ insert('πŸ³οΈβ€βš§οΈ')
+ screen:expect([[
+ ^πŸ³οΈβ€βš§οΈ |
+ {1:~ }|*4
+ 1,1 All |
+ ]])
+
+ feed('a word<esc>')
+ screen:expect([[
+ πŸ³οΈβ€βš§οΈ wor^d |
+ {1:~ }|*4
+ 1,21-7 All |
+ ]])
+
+ feed('0')
+ screen:expect([[
+ ^πŸ³οΈβ€βš§οΈ word |
+ {1:~ }|*4
+ 1,1 All |
+ ]])
+
+ feed('l')
+ screen:expect([[
+ πŸ³οΈβ€βš§οΈ^ word |
+ {1:~ }|*4
+ 1,17-3 All |
+ ]])
+
+ feed('h')
+ screen:expect([[
+ ^πŸ³οΈβ€βš§οΈ word |
+ {1:~ }|*4
+ 1,1 All |
+ ]])
+
+ feed('o❀️ variant selected<esc>')
+ screen:expect([[
+ πŸ³οΈβ€βš§οΈ word |
+ ❀️ variant selecte^d |
+ {1:~ }|*3
+ 2,23-19 All |
+ ]])
+
+ feed('0')
+ screen:expect([[
+ πŸ³οΈβ€βš§οΈ word |
+ ^❀️ variant selected |
+ {1:~ }|*3
+ 2,1 All |
+ ]])
+
+ feed('l')
+ screen:expect([[
+ πŸ³οΈβ€βš§οΈ word |
+ ❀️^ variant selected |
+ {1:~ }|*3
+ 2,7-3 All |
+ ]])
+
+ feed('h')
+ screen:expect([[
+ πŸ³οΈβ€βš§οΈ word |
+ ^❀️ variant selected |
+ {1:~ }|*3
+ 2,1 All |
+ ]])
+
+ -- without selector: single width (note column 18 and not 19)
+ feed('o❀ variant selected<esc>')
+ screen:expect([[
+ πŸ³οΈβ€βš§οΈ word |
+ ❀️ variant selected |
+ ❀ variant selecte^d |
+ {1:~ }|*2
+ 3,20-18 All |
+ ]])
+ end)
end)
describe('multibyte rendering: statusline', function()
@@ -348,11 +428,12 @@ describe('multibyte rendering: statusline', function()
it('non-printable followed by MAX_MCO unicode combination points', function()
command('set statusline=ΒŸα·°βƒ―ΜΈβƒβƒ§βƒ')
-- U+9F + U+1DF0 + U+20EF + U+0338 + U+20D0 + U+20E7 + U+20DD
+ -- TODO: not ideal, better with plain ">" and then space+combining
screen:expect([[
- ^ |
- {1:~ }|
- {3:<9f><1df0><20ef><0338><20d0><20e7><20dd>}|
- |
+ ^ |
+ {1:~ }|
+ {3:<9f≯⃯ᷰ⃐⃧⃝ }|
+ |
]])
end)
@@ -368,9 +449,20 @@ describe('multibyte rendering: statusline', function()
}
end)
- it('unprintable chars in filename with default stl', function()
+ it('emoji with ZWJ in filename with default stl', function()
command('file πŸ§‘β€πŸ’»')
- -- TODO: this is wrong but avoids a crash
+ screen:expect {
+ grid = [[
+ ^ |
+ {1:~ }|
+ {3:πŸ§‘β€πŸ’» }|
+ |
+ ]],
+ }
+ end)
+
+ it('unprintable chars in filename with default stl', function()
+ command('file πŸ§‘β€‹πŸ’»')
screen:expect {
grid = [[
^ |
@@ -381,15 +473,27 @@ describe('multibyte rendering: statusline', function()
}
end)
- it('unprintable chars in filename with custom stl', function()
+ it('emoji with ZWJ in filename with custom stl', function()
command('set statusline=xx%#ErrorMsg#%f%##yy')
command('file πŸ§‘β€πŸ’»')
- -- TODO: this is also wrong but also avoids a crash
screen:expect {
grid = [[
^ |
{1:~ }|
- {3:xx}{9:πŸ§‘<200d>πŸ’»}{3:yy }|
+ {3:xx}{9:πŸ§‘β€πŸ’»}{3:yy }|
+ |
+ ]],
+ }
+ end)
+
+ it('unprintable chars in filename with custom stl', function()
+ command('set statusline=xx%#ErrorMsg#%f%##yy')
+ command('file πŸ§‘β€‹πŸ’»')
+ screen:expect {
+ grid = [[
+ ^ |
+ {1:~ }|
+ {3:xx}{9:πŸ§‘<200b>πŸ’»}{3:yy }|
|
]],
}