diff options
author | Rom Grk <romgrk.cc@gmail.com> | 2020-10-26 18:48:39 -0400 |
---|---|---|
committer | Rom Grk <romgrk.cc@gmail.com> | 2020-10-31 19:54:06 -0400 |
commit | 10bf69a43e8f58b0d49bc6253e4e2758060670a8 (patch) | |
tree | 421994bbf735a3477bec04cde91af2157a0ac10b /test/unit/buffer_spec.lua | |
parent | b6897ebc0c623d0a74c221c3030c7eaf17b7e151 (diff) | |
download | rneovim-10bf69a43e8f58b0d49bc6253e4e2758060670a8.tar.gz rneovim-10bf69a43e8f58b0d49bc6253e4e2758060670a8.tar.bz2 rneovim-10bf69a43e8f58b0d49bc6253e4e2758060670a8.zip |
vim-patch:8.2.1909: number of status line items is limited to 80
Problem: Number of status line items is limited to 80.
Solution: Dynamically allocate the arrays. (Rom Grk, closes vim/vim#7181)
https://github.com/vim/vim/commit/8133cc6bf454eb90bb0868f7cf806fce5c0c9fe6
The members of stl_item_T have not been prefixed with stl_ contrary to
the vim patch because the amount of stl_ prefixes on single lines of
code in that region was hurtful to readability.
Diffstat (limited to 'test/unit/buffer_spec.lua')
-rw-r--r-- | test/unit/buffer_spec.lua | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua index bf4e5a0e6d..3692e19379 100644 --- a/test/unit/buffer_spec.lua +++ b/test/unit/buffer_spec.lua @@ -212,7 +212,7 @@ describe('buffer functions', function() describe('build_stl_str_hl', function() local buffer_byte_size = 100 - local STL_MAX_ITEM = 80 + local STL_INITIAL_ITEMS = 20 local output_buffer = '' -- This function builds the statusline @@ -431,31 +431,23 @@ describe('buffer functions', function() 'aaaa%=b%=c%=d%=e%=fg%=hi%=jk%=lmnop%=qrstuv%=wxyz', 'aaaa b c d e fg hi jk lmnop qrstuv wxyz') - -- maximum stl item testing - statusline_test('should handle a much larger amount of = than buffer locations', 20, - ('%='):rep(STL_MAX_ITEM - 1), - ' ') -- Should be fine, because within limit - statusline_test('should handle a much larger amount of = than stl max item', 20, - ('%='):rep(STL_MAX_ITEM + 1), - ' E541') -- Should show the VIM error + -- stl item testing + local tabline = '' + for i= 1, 1000 do + tabline = tabline .. (i % 2 == 0 and '%#TabLineSel#' or '%#TabLineFill#') .. tostring(i % 2) + end + statusline_test('should handle a large amount of any items', 20, + tabline, + '<1010101010101010101') -- Should not show any error + statusline_test('should handle a larger amount of = than stl initial item', 20, + ('%='):rep(STL_INITIAL_ITEMS * 5), + ' ') -- Should not show any error statusline_test('should handle many extra characters', 20, - 'a' .. ('a'):rep(STL_MAX_ITEM * 4), - '<aaaaaaaaaaaaaaaaaaa') -- Does not show the error because there are no items - statusline_test('should handle almost maximum of characters and flags', 20, - 'a' .. ('%=a'):rep(STL_MAX_ITEM - 1), - 'a<aaaaaaaaaaaaaaaaaa') -- Should not show the VIM error - statusline_test('should handle many extra characters and flags', 20, - 'a' .. ('%=a'):rep(STL_MAX_ITEM), - 'a<aaaaaaaaaaaaa E541') -- Should show the VIM error + 'a' .. ('a'):rep(STL_INITIAL_ITEMS * 5), + '<aaaaaaaaaaaaaaaaaaa') -- Does not show any error statusline_test('should handle many extra characters and flags', 20, - 'a' .. ('%=a'):rep(STL_MAX_ITEM * 2), - 'a<aaaaaaaaaaaaa E541') -- Should show the VIM error - statusline_test('should handle many extra characters and flags with truncation', 20, - 'aaa%<' .. ('%=a'):rep(STL_MAX_ITEM), - 'aaa<aaaaaaaaaaa E541') -- Should show the VIM error - statusline_test('should handle many characters and flags before and after truncation', 20, - 'a%=a%=a%<' .. ('%=a'):rep(STL_MAX_ITEM), - 'aaa<aaaaaaaaaaa E541') -- Should show the VIM error + 'a' .. ('%=a'):rep(STL_INITIAL_ITEMS * 2), + 'a<aaaaaaaaaaaaaaaaaa') -- Should not show any error -- multi-byte testing |