diff options
author | zeertzjq <zeertzjq@outlook.com> | 2021-11-17 07:07:15 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2021-11-17 07:11:40 +0800 |
commit | 8c24e1462c567c30410d3a45e552ecffc95bbd1d (patch) | |
tree | 07f01e715a4fb7f5c69bfaa26e039cf67c2c167e /src/nvim/option.c | |
parent | eba317d7a907a76e6e265c0fe0b97a87f17cf943 (diff) | |
download | rneovim-8c24e1462c567c30410d3a45e552ecffc95bbd1d.tar.gz rneovim-8c24e1462c567c30410d3a45e552ecffc95bbd1d.tar.bz2 rneovim-8c24e1462c567c30410d3a45e552ecffc95bbd1d.zip |
vim-patch:8.2.2518: 'listchars' should be window-local
Problem: 'listchars' should be window-local.
Solution: Make 'listchars' global-local. (Yegappan Lakshmanan, Marco Hinz,
closes vim/vim#5206, closes vim/vim#7850)
https://github.com/vim/vim/commit/eed9d46293f0842aad0d50ff3a526f9a48b12421
Nvim already has this feature, but it implements :set listchars the same
as :setglobal listchars, which is incorrect. Vim's implementation of
:set listchars is correct: using :set listchars clears local value.
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 5dd7d708f9..d301b17265 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -2650,14 +2650,19 @@ ambw_end: } s = skip_to_option_part(s); } - } else if (varp == &p_lcs) { // 'listchars' + } else if (varp == &p_lcs) { // global 'listchars' errmsg = set_chars_option(curwin, varp, false); - if (!errmsg) { + if (errmsg == NULL) { + // The current window is set to use the global 'listchars' value. + // So clear the window-local value. + if (!(opt_flags & OPT_GLOBAL)) { + clear_string_option(&curwin->w_p_lcs); + } FOR_ALL_TAB_WINDOWS(tp, wp) { set_chars_option(wp, &wp->w_p_lcs, true); } + redraw_all_later(NOT_VALID); } - redraw_all_later(NOT_VALID); } else if (varp == &curwin->w_p_lcs) { // local 'listchars' errmsg = set_chars_option(curwin, varp, true); } else if (varp == &p_fcs) { // 'fillchars' |