aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/multibyte_spec.lua
diff options
context:
space:
mode:
authorMichael Hoffmann <michoffmann.potsdam@gmail.com>2018-07-10 21:42:48 +0200
committerJustin M. Keyes <justinkz@gmail.com>2018-07-10 21:57:26 +0200
commit0ed8b12a07e71f9c7e42cadee8c6024d79a39beb (patch)
treee6d8d711eb1abcf642282825b7a6921c11dd01d7 /test/functional/ui/multibyte_spec.lua
parent627cc1b3d8d7fa6dc09f2f48fd5e3567f85d46cd (diff)
downloadrneovim-0ed8b12a07e71f9c7e42cadee8c6024d79a39beb.tar.gz
rneovim-0ed8b12a07e71f9c7e42cadee8c6024d79a39beb.tar.bz2
rneovim-0ed8b12a07e71f9c7e42cadee8c6024d79a39beb.zip
transstr_buf: fix length comparison #8681
closes #8466 closes #8664 Regression by 0d7daaad98d5. - Fix length comparison. - Fix loop(s) which iterated over all fields of array `pcc` even if it was not filled up (try unicode 0x9f as statusline character). Note about the tests: - To input unicode with more than two hex digits you can use <C-v>U...: a + U+fe20: a︠ a + U+fe20 + U+fe21: a︠︡
Diffstat (limited to 'test/functional/ui/multibyte_spec.lua')
-rw-r--r--test/functional/ui/multibyte_spec.lua63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/functional/ui/multibyte_spec.lua b/test/functional/ui/multibyte_spec.lua
index 278480ec4f..3e63353ad2 100644
--- a/test/functional/ui/multibyte_spec.lua
+++ b/test/functional/ui/multibyte_spec.lua
@@ -1,6 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
+local command = helpers.command
local feed = helpers.feed
local feed_command = helpers.feed_command
local insert = helpers.insert
@@ -120,3 +121,65 @@ describe("multibyte rendering", function()
end)
end)
+describe('multibyte rendering: statusline', function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(40, 4)
+ screen:attach()
+ command('set laststatus=2')
+ end)
+
+ after_each(function()
+ screen:detach()
+ end)
+
+ it('last char shows (multibyte)', function()
+ command('set statusline=你好')
+ screen:expect([[
+ ^ |
+ ~ |
+ 你好 |
+ |
+ ]])
+ end)
+ it('last char shows (single byte)', function()
+ command('set statusline=abc')
+ screen:expect([[
+ ^ |
+ ~ |
+ abc |
+ |
+ ]])
+ end)
+ it('unicode control points', function()
+ command('set statusline=Ÿ')
+ screen:expect([[
+ ^ |
+ ~ |
+ <9f> |
+ |
+ ]])
+ end)
+ it('MAX_MCO (6) unicode combination points', function()
+ command('set statusline=o̸⃯ᷰ⃐⃧⃝')
+ -- o + U+1DF0 + U+20EF + U+0338 + U+20D0 + U+20E7 + U+20DD
+ screen:expect([[
+ ^ |
+ ~ |
+ o̸⃯ᷰ⃐⃧⃝ |
+ |
+ ]])
+ end)
+ 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
+ screen:expect([[
+ ^ |
+ ~ |
+ <9f><1df0><20ef><0338><20d0><20e7><20dd>|
+ |
+ ]])
+ end)
+end)