fix(statuscolumn): foldcolumn buffer is too small (#21761)

Resolve https://github.com/neovim/neovim/issues/21759.
This commit is contained in:
luukvbaal 2023-01-12 16:04:43 +01:00 committed by GitHub
parent 443bbfd59e
commit 0fd59f0121
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View File

@ -1426,7 +1426,7 @@ struct statuscol {
int sign_attr[SIGN_SHOW_MAX + 1]; ///< attributes used for signs int sign_attr[SIGN_SHOW_MAX + 1]; ///< attributes used for signs
int truncate; ///< truncated width int truncate; ///< truncated width
bool draw; ///< draw statuscolumn or not bool draw; ///< draw statuscolumn or not
char fold_text[10]; ///< text in fold column (%C) char fold_text[9 * 4 + 1]; ///< text in fold column (%C)
char *sign_text[SIGN_SHOW_MAX + 1]; ///< text in sign column (%s) char *sign_text[SIGN_SHOW_MAX + 1]; ///< text in sign column (%s)
char text[MAXPATHL]; ///< text in status column char text[MAXPATHL]; ///< text in status column
char *textp; ///< current position in text char *textp; ///< current position in text

View File

@ -367,4 +367,26 @@ describe('statuscolumn', function()
meths.input_mouse('right', 'press', '', 0, 3, 0) meths.input_mouse('right', 'press', '', 0, 3, 0)
eq('0 4 r 7', eval("g:testvar")) eq('0 4 r 7', eval("g:testvar"))
end) end)
it('fits maximum multibyte foldcolumn #21759', function()
command('set stc=%C fdc=9 fillchars=foldsep:𒀀')
for _ = 0,8 do command('norm zfjzo') end
screen:expect([[
aaaaa |
aaaaa |
aaaaa |
aaaaa |
--------- ^aaaaa |
𒀀𒀀𒀀𒀀𒀀𒀀𒀀𒀀𒀀 aaaaa |
aaaaa |
aaaaa |
aaaaa |
aaaaa |
aaaaa |
aaaaa |
aaaaa |
|
]])
end)
end) end)