mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
fix(diff): avoid restoring invalid 'foldcolumn' value
Use "0" for 'foldcolumn' when w_p_fdc_save is empty, like how
"manual" is used for 'foldmethod' when w_p_fdm_save is empty.
(cherry picked from commit 5f04b164e6
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
f427fc780d
commit
4a52467f77
@@ -1482,7 +1482,7 @@ void ex_diffoff(exarg_T *eap)
|
||||
free_string_option(wp->w_p_fdm);
|
||||
wp->w_p_fdm = xstrdup(*wp->w_p_fdm_save ? wp->w_p_fdm_save : "manual");
|
||||
free_string_option(wp->w_p_fdc);
|
||||
wp->w_p_fdc = xstrdup(wp->w_p_fdc_save);
|
||||
wp->w_p_fdc = xstrdup(*wp->w_p_fdc_save ? wp->w_p_fdc_save : "0");
|
||||
|
||||
if (wp->w_p_fdl == 0) {
|
||||
wp->w_p_fdl = wp->w_p_fdl_save;
|
||||
|
@@ -8,6 +8,8 @@ local insert = helpers.insert
|
||||
local write_file = helpers.write_file
|
||||
local dedent = helpers.dedent
|
||||
local exec = helpers.exec
|
||||
local eq = helpers.eq
|
||||
local meths = helpers.meths
|
||||
|
||||
describe('Diff mode screen', function()
|
||||
local fname = 'Xtest-functional-diff-screen-1'
|
||||
@@ -1315,6 +1317,26 @@ it('Align the filler lines when changing text in diff mode', function()
|
||||
]]}
|
||||
end)
|
||||
|
||||
it("diff mode doesn't restore invalid 'foldcolumn' value #21647", function()
|
||||
clear()
|
||||
local screen = Screen.new(60, 6)
|
||||
screen:set_default_attr_ids({
|
||||
[0] = {foreground = Screen.colors.Blue, bold = true};
|
||||
})
|
||||
screen:attach()
|
||||
eq('0', meths.get_option_value('foldcolumn', {}))
|
||||
command('diffsplit | bd')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
eq('0', meths.get_option_value('foldcolumn', {}))
|
||||
end)
|
||||
|
||||
-- oldtest: Test_diff_binary()
|
||||
it('diff mode works properly if file contains NUL bytes vim-patch:8.2.3925', function()
|
||||
clear()
|
||||
|
Reference in New Issue
Block a user