mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 12:38:33 +00:00
vim-patch:9.0.2126: unused assignments when checking 'listchars' (#26182)
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: vim/vim#13559
00624a2fa0
This commit is contained in:
@@ -2871,9 +2871,6 @@ static const char *set_chars_option(win_T *wp, const char *value, const bool is_
|
|||||||
} else {
|
} else {
|
||||||
wp->w_p_fcs_chars = fcs_chars;
|
wp->w_p_fcs_chars = fcs_chars;
|
||||||
}
|
}
|
||||||
} else if (is_listchars) {
|
|
||||||
xfree(lcs_chars.multispace);
|
|
||||||
xfree(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=eol:$ " Accommodate Nvim default
|
set listchars=eol:$ " Accommodate Nvim default
|
||||||
|
Reference in New Issue
Block a user