mirror of
https://github.com/vim/vim.git
synced 2025-07-25 10:54:51 -04:00
patch 9.0.2126: unused assignments when checking 'listchars'
Problem: Unused assignments when checking the value of 'listchars'. Solution: Loop only once when just checking the value. Add a test to check that this change doesn't cause double-free. closes: #13559 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
40ed6711bd
commit
00624a2fa0
@ -4726,7 +4726,7 @@ set_chars_option(win_T *wp, char_u *value, int is_listchars, int apply)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// first round: check for valid value, second round: assign values
|
// first round: check for valid value, second round: assign values
|
||||||
for (round = 0; round <= 1; ++round)
|
for (round = 0; round <= (apply ? 1 : 0); ++round)
|
||||||
{
|
{
|
||||||
if (round > 0)
|
if (round > 0)
|
||||||
{
|
{
|
||||||
@ -4913,11 +4913,6 @@ set_chars_option(win_T *wp, char_u *value, int is_listchars, int apply)
|
|||||||
wp->w_fill_chars = fill_chars;
|
wp->w_fill_chars = fill_chars;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (is_listchars)
|
|
||||||
{
|
|
||||||
vim_free(lcs_chars.multispace);
|
|
||||||
vim_free(lcs_chars.leadmultispace);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL; // no error
|
return NULL; // no error
|
||||||
}
|
}
|
||||||
|
@ -265,6 +265,11 @@ func Test_listchars()
|
|||||||
call Check_listchars(expected, 5, 12)
|
call Check_listchars(expected, 5, 12)
|
||||||
call assert_equal(expected, split(execute("%list"), "\n"))
|
call assert_equal(expected, split(execute("%list"), "\n"))
|
||||||
|
|
||||||
|
" Changing the value of 'ambiwidth' twice shouldn't cause double-free when
|
||||||
|
" "leadmultispace" is specified.
|
||||||
|
set ambiwidth=double
|
||||||
|
set ambiwidth&
|
||||||
|
|
||||||
" Test leadmultispace and lead and space
|
" Test leadmultispace and lead and space
|
||||||
normal ggdG
|
normal ggdG
|
||||||
set listchars&
|
set listchars&
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2126,
|
||||||
/**/
|
/**/
|
||||||
2125,
|
2125,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user