Mercurial > vim
comparison src/option.c @ 9852:4eea48b76d03 v7.4.2201
commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 12 18:29:59 2016 +0200
patch 7.4.2201
Problem: The sign column disappears when the last sign is deleted.
Solution: Add the 'signcolumn' option. (Christian Brabandt)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 12 Aug 2016 18:45:06 +0200 |
parents | e34e4547f3d1 |
children | eed41404e383 |
comparison
equal
deleted
inserted
replaced
9851:eafd017d8a5a | 9852:4eea48b76d03 |
---|---|
251 #endif | 251 #endif |
252 #ifdef FEAT_CONCEAL | 252 #ifdef FEAT_CONCEAL |
253 # define PV_COCU OPT_WIN(WV_COCU) | 253 # define PV_COCU OPT_WIN(WV_COCU) |
254 # define PV_COLE OPT_WIN(WV_COLE) | 254 # define PV_COLE OPT_WIN(WV_COLE) |
255 #endif | 255 #endif |
256 #ifdef FEAT_SIGNS | |
257 # define PV_SCL OPT_WIN(WV_SCL) | |
258 #endif | |
256 | 259 |
257 /* WV_ and BV_ values get typecasted to this for the "indir" field */ | 260 /* WV_ and BV_ values get typecasted to this for the "indir" field */ |
258 typedef enum | 261 typedef enum |
259 { | 262 { |
260 PV_NONE = 0, | 263 PV_NONE = 0, |
2408 (char_u *)&p_ss, PV_NONE, | 2411 (char_u *)&p_ss, PV_NONE, |
2409 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, | 2412 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
2410 {"sidescrolloff", "siso", P_NUM|P_VI_DEF|P_VIM|P_RBUF, | 2413 {"sidescrolloff", "siso", P_NUM|P_VI_DEF|P_VIM|P_RBUF, |
2411 (char_u *)&p_siso, PV_NONE, | 2414 (char_u *)&p_siso, PV_NONE, |
2412 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, | 2415 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, |
2416 {"signcolumn", "scl", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN, | |
2417 #ifdef FEAT_SIGNS | |
2418 (char_u *)VAR_WIN, PV_SCL, | |
2419 {(char_u *)"auto", (char_u *)0L} SCRIPTID_INIT}, | |
2420 #else | |
2421 (char_u *)NULL, PV_NONE, | |
2422 {(char_u *)NULL, (char_u *)0L} | |
2423 #endif | |
2413 {"slowopen", "slow", P_BOOL|P_VI_DEF, | 2424 {"slowopen", "slow", P_BOOL|P_VI_DEF, |
2414 (char_u *)NULL, PV_NONE, | 2425 (char_u *)NULL, PV_NONE, |
2415 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, | 2426 {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, |
2416 {"smartcase", "scs", P_BOOL|P_VI_DEF|P_VIM, | 2427 {"smartcase", "scs", P_BOOL|P_VI_DEF|P_VIM, |
2417 (char_u *)&p_scs, PV_NONE, | 2428 (char_u *)&p_scs, PV_NONE, |
3073 NULL}; | 3084 NULL}; |
3074 static char *(p_fcl_values[]) = {"all", NULL}; | 3085 static char *(p_fcl_values[]) = {"all", NULL}; |
3075 #endif | 3086 #endif |
3076 #ifdef FEAT_INS_EXPAND | 3087 #ifdef FEAT_INS_EXPAND |
3077 static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "noinsert", "noselect", NULL}; | 3088 static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "noinsert", "noselect", NULL}; |
3089 #endif | |
3090 #ifdef FEAT_SIGNS | |
3091 static char *(p_scl_values[]) = {"yes", "no", "auto", NULL}; | |
3078 #endif | 3092 #endif |
3079 | 3093 |
3080 static void set_option_default(int, int opt_flags, int compatible); | 3094 static void set_option_default(int, int opt_flags, int compatible); |
3081 static void set_options_default(int opt_flags); | 3095 static void set_options_default(int opt_flags); |
3082 static char_u *term_bg_default(void); | 3096 static char_u *term_bg_default(void); |
6976 else | 6990 else |
6977 completeopt_was_set(); | 6991 completeopt_was_set(); |
6978 } | 6992 } |
6979 #endif /* FEAT_INS_EXPAND */ | 6993 #endif /* FEAT_INS_EXPAND */ |
6980 | 6994 |
6995 #ifdef FEAT_SIGNS | |
6996 /* 'signcolumn' */ | |
6997 else if (varp == &curwin->w_p_scl) | |
6998 { | |
6999 if (check_opt_strings(*varp, p_scl_values, FALSE) != OK) | |
7000 errmsg = e_invarg; | |
7001 } | |
7002 #endif | |
7003 | |
6981 | 7004 |
6982 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) | 7005 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) |
6983 else if (varp == &p_toolbar) | 7006 else if (varp == &p_toolbar) |
6984 { | 7007 { |
6985 if (opt_strings_flags(p_toolbar, p_toolbar_values, | 7008 if (opt_strings_flags(p_toolbar, p_toolbar_values, |
10431 #endif | 10454 #endif |
10432 case PV_WM: return (char_u *)&(curbuf->b_p_wm); | 10455 case PV_WM: return (char_u *)&(curbuf->b_p_wm); |
10433 #ifdef FEAT_KEYMAP | 10456 #ifdef FEAT_KEYMAP |
10434 case PV_KMAP: return (char_u *)&(curbuf->b_p_keymap); | 10457 case PV_KMAP: return (char_u *)&(curbuf->b_p_keymap); |
10435 #endif | 10458 #endif |
10459 #ifdef FEAT_SIGNS | |
10460 case PV_SCL: return (char_u *)&(curwin->w_p_scl); | |
10461 #endif | |
10436 default: EMSG(_("E356: get_varp ERROR")); | 10462 default: EMSG(_("E356: get_varp ERROR")); |
10437 } | 10463 } |
10438 /* always return a valid pointer to avoid a crash! */ | 10464 /* always return a valid pointer to avoid a crash! */ |
10439 return (char_u *)&(curbuf->b_p_wm); | 10465 return (char_u *)&(curbuf->b_p_wm); |
10440 } | 10466 } |
10547 to->wo_fde = vim_strsave(from->wo_fde); | 10573 to->wo_fde = vim_strsave(from->wo_fde); |
10548 to->wo_fdt = vim_strsave(from->wo_fdt); | 10574 to->wo_fdt = vim_strsave(from->wo_fdt); |
10549 # endif | 10575 # endif |
10550 to->wo_fmr = vim_strsave(from->wo_fmr); | 10576 to->wo_fmr = vim_strsave(from->wo_fmr); |
10551 #endif | 10577 #endif |
10578 #ifdef FEAT_SIGNS | |
10579 to->wo_scl = vim_strsave(from->wo_scl); | |
10580 #endif | |
10552 check_winopt(to); /* don't want NULL pointers */ | 10581 check_winopt(to); /* don't want NULL pointers */ |
10553 } | 10582 } |
10554 | 10583 |
10555 /* | 10584 /* |
10556 * Check string options in a window for a NULL value. | 10585 * Check string options in a window for a NULL value. |
10576 check_string_option(&wop->wo_fde); | 10605 check_string_option(&wop->wo_fde); |
10577 check_string_option(&wop->wo_fdt); | 10606 check_string_option(&wop->wo_fdt); |
10578 # endif | 10607 # endif |
10579 check_string_option(&wop->wo_fmr); | 10608 check_string_option(&wop->wo_fmr); |
10580 #endif | 10609 #endif |
10610 #ifdef FEAT_SIGNS | |
10611 check_string_option(&wop->wo_scl); | |
10612 #endif | |
10581 #ifdef FEAT_RIGHTLEFT | 10613 #ifdef FEAT_RIGHTLEFT |
10582 check_string_option(&wop->wo_rlc); | 10614 check_string_option(&wop->wo_rlc); |
10583 #endif | 10615 #endif |
10584 #ifdef FEAT_STL_OPT | 10616 #ifdef FEAT_STL_OPT |
10585 check_string_option(&wop->wo_stl); | 10617 check_string_option(&wop->wo_stl); |
10608 # ifdef FEAT_EVAL | 10640 # ifdef FEAT_EVAL |
10609 clear_string_option(&wop->wo_fde); | 10641 clear_string_option(&wop->wo_fde); |
10610 clear_string_option(&wop->wo_fdt); | 10642 clear_string_option(&wop->wo_fdt); |
10611 # endif | 10643 # endif |
10612 clear_string_option(&wop->wo_fmr); | 10644 clear_string_option(&wop->wo_fmr); |
10645 #endif | |
10646 #ifdef FEAT_SIGNS | |
10647 clear_string_option(&wop->wo_scl); | |
10613 #endif | 10648 #endif |
10614 #ifdef FEAT_LINEBREAK | 10649 #ifdef FEAT_LINEBREAK |
10615 clear_string_option(&wop->wo_briopt); | 10650 clear_string_option(&wop->wo_briopt); |
10616 #endif | 10651 #endif |
10617 #ifdef FEAT_RIGHTLEFT | 10652 #ifdef FEAT_RIGHTLEFT |
12272 unsigned int | 12307 unsigned int |
12273 get_bkc_value(buf_T *buf) | 12308 get_bkc_value(buf_T *buf) |
12274 { | 12309 { |
12275 return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags; | 12310 return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags; |
12276 } | 12311 } |
12312 | |
12313 #if defined(FEAT_SIGNS) || defined(PROTO) | |
12314 /* | |
12315 * Return TRUE when window "wp" has a column to draw signs in. | |
12316 */ | |
12317 int | |
12318 signcolumn_on(win_T *wp) | |
12319 { | |
12320 if (*wp->w_p_scl == 'n') | |
12321 return FALSE; | |
12322 if (*wp->w_p_scl == 'y') | |
12323 return TRUE; | |
12324 return (wp->w_buffer->b_signlist != NULL | |
12325 # ifdef FEAT_NETBEANS_INTG | |
12326 || wp->w_buffer->b_has_sign_column | |
12327 # endif | |
12328 ); | |
12329 } | |
12330 #endif |