Mercurial > vim
comparison src/option.c @ 29387:9dce192d1ac2 v9.0.0036
patch 9.0.0036: 'fillchars' cannot have window-local values
Commit: https://github.com/vim/vim/commit/96ba25ac01279f73c0ecb5d4aa4ff37aa359e5eb
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jul 4 17:34:33 2022 +0100
patch 9.0.0036: 'fillchars' cannot have window-local values
Problem: 'fillchars' cannot have window-local values.
Solution: Make 'fillchars' global-local. (closes https://github.com/vim/vim/issues/5206)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 04 Jul 2022 18:45:04 +0200 |
parents | 6cdf55afaae9 |
children | caaf5b270018 |
comparison
equal
deleted
inserted
replaced
29386:f0f3018d296b | 29387:9dce192d1ac2 |
---|---|
2434 | 2434 |
2435 // Parse default for 'listchars'. | 2435 // Parse default for 'listchars'. |
2436 (void)set_chars_option(curwin, &curwin->w_p_lcs); | 2436 (void)set_chars_option(curwin, &curwin->w_p_lcs); |
2437 | 2437 |
2438 // Parse default for 'fillchars'. | 2438 // Parse default for 'fillchars'. |
2439 (void)set_chars_option(curwin, &p_fcs); | 2439 (void)set_chars_option(curwin, &curwin->w_p_fcs); |
2440 | 2440 |
2441 #ifdef FEAT_CLIPBOARD | 2441 #ifdef FEAT_CLIPBOARD |
2442 // Parse default for 'clipboard' | 2442 // Parse default for 'clipboard' |
2443 (void)check_clipboard_option(); | 2443 (void)check_clipboard_option(); |
2444 #endif | 2444 #endif |
5205 case PV_LCS: | 5205 case PV_LCS: |
5206 clear_string_option(&((win_T *)from)->w_p_lcs); | 5206 clear_string_option(&((win_T *)from)->w_p_lcs); |
5207 set_chars_option((win_T *)from, &((win_T *)from)->w_p_lcs); | 5207 set_chars_option((win_T *)from, &((win_T *)from)->w_p_lcs); |
5208 redraw_later(NOT_VALID); | 5208 redraw_later(NOT_VALID); |
5209 break; | 5209 break; |
5210 case PV_FCS: | |
5211 clear_string_option(&((win_T *)from)->w_p_fcs); | |
5212 set_chars_option((win_T *)from, &((win_T *)from)->w_p_fcs); | |
5213 redraw_later(NOT_VALID); | |
5214 break; | |
5210 case PV_VE: | 5215 case PV_VE: |
5211 clear_string_option(&((win_T *)from)->w_p_ve); | 5216 clear_string_option(&((win_T *)from)->w_p_ve); |
5212 ((win_T *)from)->w_ve_flags = 0; | 5217 ((win_T *)from)->w_ve_flags = 0; |
5213 break; | 5218 break; |
5214 } | 5219 } |
5270 case PV_UL: return (char_u *)&(curbuf->b_p_ul); | 5275 case PV_UL: return (char_u *)&(curbuf->b_p_ul); |
5271 case PV_LW: return (char_u *)&(curbuf->b_p_lw); | 5276 case PV_LW: return (char_u *)&(curbuf->b_p_lw); |
5272 case PV_BKC: return (char_u *)&(curbuf->b_p_bkc); | 5277 case PV_BKC: return (char_u *)&(curbuf->b_p_bkc); |
5273 case PV_MENC: return (char_u *)&(curbuf->b_p_menc); | 5278 case PV_MENC: return (char_u *)&(curbuf->b_p_menc); |
5274 case PV_LCS: return (char_u *)&(curwin->w_p_lcs); | 5279 case PV_LCS: return (char_u *)&(curwin->w_p_lcs); |
5280 case PV_FCS: return (char_u *)&(curwin->w_p_fcs); | |
5275 case PV_VE: return (char_u *)&(curwin->w_p_ve); | 5281 case PV_VE: return (char_u *)&(curwin->w_p_ve); |
5276 | 5282 |
5277 } | 5283 } |
5278 return NULL; // "cannot happen" | 5284 return NULL; // "cannot happen" |
5279 } | 5285 } |
5373 case PV_ARAB: return (char_u *)&(curwin->w_p_arab); | 5379 case PV_ARAB: return (char_u *)&(curwin->w_p_arab); |
5374 #endif | 5380 #endif |
5375 case PV_LIST: return (char_u *)&(curwin->w_p_list); | 5381 case PV_LIST: return (char_u *)&(curwin->w_p_list); |
5376 case PV_LCS: return *curwin->w_p_lcs != NUL | 5382 case PV_LCS: return *curwin->w_p_lcs != NUL |
5377 ? (char_u *)&(curwin->w_p_lcs) : p->var; | 5383 ? (char_u *)&(curwin->w_p_lcs) : p->var; |
5384 case PV_FCS: return *curwin->w_p_fcs != NUL | |
5385 ? (char_u *)&(curwin->w_p_fcs) : p->var; | |
5378 case PV_VE: return *curwin->w_p_ve != NUL | 5386 case PV_VE: return *curwin->w_p_ve != NUL |
5379 ? (char_u *)&(curwin->w_p_ve) : p->var; | 5387 ? (char_u *)&(curwin->w_p_ve) : p->var; |
5380 #ifdef FEAT_SPELL | 5388 #ifdef FEAT_SPELL |
5381 case PV_SPELL: return (char_u *)&(curwin->w_p_spell); | 5389 case PV_SPELL: return (char_u *)&(curwin->w_p_spell); |
5382 #endif | 5390 #endif |
5598 #ifdef FEAT_SYN_HL | 5606 #ifdef FEAT_SYN_HL |
5599 fill_culopt_flags(NULL, wp); | 5607 fill_culopt_flags(NULL, wp); |
5600 check_colorcolumn(wp); | 5608 check_colorcolumn(wp); |
5601 #endif | 5609 #endif |
5602 set_chars_option(wp, &wp->w_p_lcs); | 5610 set_chars_option(wp, &wp->w_p_lcs); |
5611 set_chars_option(wp, &wp->w_p_fcs); | |
5612 } | |
5613 | |
5614 static char_u * | |
5615 copy_option_val(char_u *val) | |
5616 { | |
5617 if (val == empty_option) | |
5618 return empty_option; // no need to allocate memory | |
5619 return vim_strsave(val); | |
5603 } | 5620 } |
5604 | 5621 |
5605 /* | 5622 /* |
5606 * Copy the options from one winopt_T to another. | 5623 * Copy the options from one winopt_T to another. |
5607 * Doesn't free the old option values in "to", use clear_winopt() for that. | 5624 * Doesn't free the old option values in "to", use clear_winopt() for that. |
5613 { | 5630 { |
5614 #ifdef FEAT_ARABIC | 5631 #ifdef FEAT_ARABIC |
5615 to->wo_arab = from->wo_arab; | 5632 to->wo_arab = from->wo_arab; |
5616 #endif | 5633 #endif |
5617 to->wo_list = from->wo_list; | 5634 to->wo_list = from->wo_list; |
5618 to->wo_lcs = vim_strsave(from->wo_lcs); | 5635 to->wo_lcs = copy_option_val(from->wo_lcs); |
5636 to->wo_fcs = copy_option_val(from->wo_fcs); | |
5619 to->wo_nu = from->wo_nu; | 5637 to->wo_nu = from->wo_nu; |
5620 to->wo_rnu = from->wo_rnu; | 5638 to->wo_rnu = from->wo_rnu; |
5621 to->wo_ve = vim_strsave(from->wo_ve); | 5639 to->wo_ve = copy_option_val(from->wo_ve); |
5622 to->wo_ve_flags = from->wo_ve_flags; | 5640 to->wo_ve_flags = from->wo_ve_flags; |
5623 #ifdef FEAT_LINEBREAK | 5641 #ifdef FEAT_LINEBREAK |
5624 to->wo_nuw = from->wo_nuw; | 5642 to->wo_nuw = from->wo_nuw; |
5625 #endif | 5643 #endif |
5626 #ifdef FEAT_RIGHTLEFT | 5644 #ifdef FEAT_RIGHTLEFT |
5627 to->wo_rl = from->wo_rl; | 5645 to->wo_rl = from->wo_rl; |
5628 to->wo_rlc = vim_strsave(from->wo_rlc); | 5646 to->wo_rlc = copy_option_val(from->wo_rlc); |
5629 #endif | 5647 #endif |
5630 #ifdef FEAT_LINEBREAK | 5648 #ifdef FEAT_LINEBREAK |
5631 to->wo_sbr = vim_strsave(from->wo_sbr); | 5649 to->wo_sbr = copy_option_val(from->wo_sbr); |
5632 #endif | 5650 #endif |
5633 #ifdef FEAT_STL_OPT | 5651 #ifdef FEAT_STL_OPT |
5634 to->wo_stl = vim_strsave(from->wo_stl); | 5652 to->wo_stl = copy_option_val(from->wo_stl); |
5635 #endif | 5653 #endif |
5636 to->wo_wrap = from->wo_wrap; | 5654 to->wo_wrap = from->wo_wrap; |
5637 #ifdef FEAT_DIFF | 5655 #ifdef FEAT_DIFF |
5638 to->wo_wrap_save = from->wo_wrap_save; | 5656 to->wo_wrap_save = from->wo_wrap_save; |
5639 #endif | 5657 #endif |
5640 #ifdef FEAT_LINEBREAK | 5658 #ifdef FEAT_LINEBREAK |
5641 to->wo_lbr = from->wo_lbr; | 5659 to->wo_lbr = from->wo_lbr; |
5642 to->wo_bri = from->wo_bri; | 5660 to->wo_bri = from->wo_bri; |
5643 to->wo_briopt = vim_strsave(from->wo_briopt); | 5661 to->wo_briopt = copy_option_val(from->wo_briopt); |
5644 #endif | 5662 #endif |
5645 to->wo_wcr = vim_strsave(from->wo_wcr); | 5663 to->wo_wcr = copy_option_val(from->wo_wcr); |
5646 to->wo_scb = from->wo_scb; | 5664 to->wo_scb = from->wo_scb; |
5647 to->wo_scb_save = from->wo_scb_save; | 5665 to->wo_scb_save = from->wo_scb_save; |
5648 to->wo_crb = from->wo_crb; | 5666 to->wo_crb = from->wo_crb; |
5649 to->wo_crb_save = from->wo_crb_save; | 5667 to->wo_crb_save = from->wo_crb_save; |
5650 #ifdef FEAT_SPELL | 5668 #ifdef FEAT_SPELL |
5651 to->wo_spell = from->wo_spell; | 5669 to->wo_spell = from->wo_spell; |
5652 #endif | 5670 #endif |
5653 #ifdef FEAT_SYN_HL | 5671 #ifdef FEAT_SYN_HL |
5654 to->wo_cuc = from->wo_cuc; | 5672 to->wo_cuc = from->wo_cuc; |
5655 to->wo_cul = from->wo_cul; | 5673 to->wo_cul = from->wo_cul; |
5656 to->wo_culopt = vim_strsave(from->wo_culopt); | 5674 to->wo_culopt = copy_option_val(from->wo_culopt); |
5657 to->wo_cc = vim_strsave(from->wo_cc); | 5675 to->wo_cc = copy_option_val(from->wo_cc); |
5658 #endif | 5676 #endif |
5659 #ifdef FEAT_DIFF | 5677 #ifdef FEAT_DIFF |
5660 to->wo_diff = from->wo_diff; | 5678 to->wo_diff = from->wo_diff; |
5661 to->wo_diff_saved = from->wo_diff_saved; | 5679 to->wo_diff_saved = from->wo_diff_saved; |
5662 #endif | 5680 #endif |
5663 #ifdef FEAT_CONCEAL | 5681 #ifdef FEAT_CONCEAL |
5664 to->wo_cocu = vim_strsave(from->wo_cocu); | 5682 to->wo_cocu = copy_option_val(from->wo_cocu); |
5665 to->wo_cole = from->wo_cole; | 5683 to->wo_cole = from->wo_cole; |
5666 #endif | 5684 #endif |
5667 #ifdef FEAT_TERMINAL | 5685 #ifdef FEAT_TERMINAL |
5668 to->wo_twk = vim_strsave(from->wo_twk); | 5686 to->wo_twk = copy_option_val(from->wo_twk); |
5669 to->wo_tws = vim_strsave(from->wo_tws); | 5687 to->wo_tws = copy_option_val(from->wo_tws); |
5670 #endif | 5688 #endif |
5671 #ifdef FEAT_FOLDING | 5689 #ifdef FEAT_FOLDING |
5672 to->wo_fdc = from->wo_fdc; | 5690 to->wo_fdc = from->wo_fdc; |
5673 to->wo_fdc_save = from->wo_fdc_save; | 5691 to->wo_fdc_save = from->wo_fdc_save; |
5674 to->wo_fen = from->wo_fen; | 5692 to->wo_fen = from->wo_fen; |
5675 to->wo_fen_save = from->wo_fen_save; | 5693 to->wo_fen_save = from->wo_fen_save; |
5676 to->wo_fdi = vim_strsave(from->wo_fdi); | 5694 to->wo_fdi = copy_option_val(from->wo_fdi); |
5677 to->wo_fml = from->wo_fml; | 5695 to->wo_fml = from->wo_fml; |
5678 to->wo_fdl = from->wo_fdl; | 5696 to->wo_fdl = from->wo_fdl; |
5679 to->wo_fdl_save = from->wo_fdl_save; | 5697 to->wo_fdl_save = from->wo_fdl_save; |
5680 to->wo_fdm = vim_strsave(from->wo_fdm); | 5698 to->wo_fdm = copy_option_val(from->wo_fdm); |
5681 to->wo_fdm_save = from->wo_diff_saved | 5699 to->wo_fdm_save = from->wo_diff_saved |
5682 ? vim_strsave(from->wo_fdm_save) : empty_option; | 5700 ? vim_strsave(from->wo_fdm_save) : empty_option; |
5683 to->wo_fdn = from->wo_fdn; | 5701 to->wo_fdn = from->wo_fdn; |
5684 # ifdef FEAT_EVAL | 5702 # ifdef FEAT_EVAL |
5685 to->wo_fde = vim_strsave(from->wo_fde); | 5703 to->wo_fde = copy_option_val(from->wo_fde); |
5686 to->wo_fdt = vim_strsave(from->wo_fdt); | 5704 to->wo_fdt = copy_option_val(from->wo_fdt); |
5687 # endif | 5705 # endif |
5688 to->wo_fmr = vim_strsave(from->wo_fmr); | 5706 to->wo_fmr = copy_option_val(from->wo_fmr); |
5689 #endif | 5707 #endif |
5690 #ifdef FEAT_SIGNS | 5708 #ifdef FEAT_SIGNS |
5691 to->wo_scl = vim_strsave(from->wo_scl); | 5709 to->wo_scl = copy_option_val(from->wo_scl); |
5692 #endif | 5710 #endif |
5693 | 5711 |
5694 #ifdef FEAT_EVAL | 5712 #ifdef FEAT_EVAL |
5695 // Copy the script context so that we know where the value was last set. | 5713 // Copy the script context so that we know where the value was last set. |
5696 mch_memmove(to->wo_script_ctx, from->wo_script_ctx, | 5714 mch_memmove(to->wo_script_ctx, from->wo_script_ctx, |
5751 #ifdef FEAT_LINEBREAK | 5769 #ifdef FEAT_LINEBREAK |
5752 check_string_option(&wop->wo_briopt); | 5770 check_string_option(&wop->wo_briopt); |
5753 #endif | 5771 #endif |
5754 check_string_option(&wop->wo_wcr); | 5772 check_string_option(&wop->wo_wcr); |
5755 check_string_option(&wop->wo_lcs); | 5773 check_string_option(&wop->wo_lcs); |
5774 check_string_option(&wop->wo_fcs); | |
5756 check_string_option(&wop->wo_ve); | 5775 check_string_option(&wop->wo_ve); |
5757 } | 5776 } |
5758 | 5777 |
5759 /* | 5778 /* |
5760 * Free the allocated memory inside a winopt_T. | 5779 * Free the allocated memory inside a winopt_T. |
5798 #ifdef FEAT_TERMINAL | 5817 #ifdef FEAT_TERMINAL |
5799 clear_string_option(&wop->wo_twk); | 5818 clear_string_option(&wop->wo_twk); |
5800 clear_string_option(&wop->wo_tws); | 5819 clear_string_option(&wop->wo_tws); |
5801 #endif | 5820 #endif |
5802 clear_string_option(&wop->wo_lcs); | 5821 clear_string_option(&wop->wo_lcs); |
5822 clear_string_option(&wop->wo_fcs); | |
5803 clear_string_option(&wop->wo_ve); | 5823 clear_string_option(&wop->wo_ve); |
5804 } | 5824 } |
5805 | 5825 |
5806 #ifdef FEAT_EVAL | 5826 #ifdef FEAT_EVAL |
5807 // Index into the options table for a buffer-local option enum. | 5827 // Index into the options table for a buffer-local option enum. |