diff options
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 207be0bd74..31f5ab7788 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -2007,7 +2007,7 @@ void set_init_1(void) set_options_default(0); - curbuf->b_p_initialized = TRUE; + curbuf->b_p_initialized = true; curbuf->b_p_ar = -1; /* no local 'autoread' value */ curbuf->b_p_ul = NO_LOCAL_UNDOLEVEL; check_buf_options(curbuf); @@ -2563,7 +2563,6 @@ do_set ( /* find end of name */ key = 0; if (*arg == '<') { - nextchar = 0; opt_idx = -1; /* look out for <t_>;> */ if (arg[1] == 't' && arg[2] == '_' && arg[3] && arg[4]) @@ -3481,7 +3480,7 @@ static void didset_options(void) (void)compile_cap_prog(curwin->w_s); /* set cedit_key */ (void)check_cedit(); - briopt_check(); + briopt_check(curwin); } /* @@ -3818,7 +3817,7 @@ did_set_string_option ( } /* 'breakindentopt' */ else if (varp == &curwin->w_p_briopt) { - if (briopt_check() == FAIL) + if (briopt_check(curwin) == FAIL) errmsg = e_invarg; } /* @@ -4977,7 +4976,7 @@ set_bool_option ( /* when 'readonly' is set may give W10 again */ if (curbuf->b_p_ro) - curbuf->b_did_warn = FALSE; + curbuf->b_did_warn = false; redraw_titles(); } @@ -5086,7 +5085,7 @@ set_bool_option ( did_set_title(FALSE); } else if ((int *)varp == &p_icon) { did_set_title(TRUE); - } else if ((int *)varp == &curbuf->b_changed) { + } else if ((bool *)varp == &curbuf->b_changed) { if (!value) save_file_ff(curbuf); /* Buffer is unchanged */ redraw_titles(); @@ -5782,7 +5781,7 @@ get_option_value ( else { /* Special case: 'modified' is b_changed, but we also want to consider * it set when 'ff' or 'fenc' changed. */ - if ((int *)varp == &curbuf->b_changed) + if ((bool *)varp == &curbuf->b_changed) *numval = curbufIsChanged(); else *numval = *(int *)varp; @@ -6173,8 +6172,8 @@ showoneopt ( varp = get_varp_scope(p, opt_flags); /* for 'modified' we also need to check if 'ff' or 'fenc' changed. */ - if ((p->flags & P_BOOL) && ((int *)varp == &curbuf->b_changed - ? !curbufIsChanged() : !*(int *)varp)) + if ((p->flags & P_BOOL) && ((bool *)varp == &curbuf->b_changed + ? !curbufIsChanged() : !*(bool *)varp)) MSG_PUTS("no"); else if ((p->flags & P_BOOL) && *(int *)varp < 0) MSG_PUTS("--"); @@ -6771,6 +6770,7 @@ void win_copy_options(win_T *wp_from, win_T *wp_to) copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt); /* Is this right? */ wp_to->w_farsi = wp_from->w_farsi; + briopt_check(wp_to); } /* @@ -7026,7 +7026,7 @@ void buf_copy_options(buf_T *buf, int flags) buf->b_p_isk = vim_strsave(p_isk); did_isk = TRUE; buf->b_p_ts = p_ts; - buf->b_help = FALSE; + buf->b_help = false; if (buf->b_p_bt[0] == 'h') clear_string_option(&buf->b_p_bt); buf->b_p_ma = p_ma; @@ -7038,7 +7038,7 @@ void buf_copy_options(buf_T *buf, int flags) * flag that indicates that the options have been initialized. */ if (should_copy) - buf->b_p_initialized = TRUE; + buf->b_p_initialized = true; } check_buf_options(buf); /* make sure we don't have NULLs */ @@ -8143,16 +8143,15 @@ void find_mps_values(int *initc, int *findc, int *backwards, int switchit) } } -/* This is called when 'breakindentopt' is changed and when a window is - initialized */ -int briopt_check(void) +/// This is called when 'breakindentopt' is changed and when a window is +/// initialized +static bool briopt_check(win_T *wp) { - char_u *p; int bri_shift = 0; long bri_min = 20; bool bri_sbr = false; - p = curwin->w_p_briopt; + char_u *p = wp->w_p_briopt; while (*p != NUL) { if (STRNCMP(p, "shift:", 6) == 0 @@ -8172,15 +8171,15 @@ int briopt_check(void) bri_sbr = true; } if (*p != ',' && *p != NUL) - return FAIL; + return false; if (*p == ',') ++p; } - curwin->w_p_brishift = bri_shift; - curwin->w_p_brimin = bri_min; - curwin->w_p_brisbr = bri_sbr; + wp->w_p_brishift = bri_shift; + wp->w_p_brimin = bri_min; + wp->w_p_brisbr = bri_sbr; - return OK; + return true; } |