forked from aniani/vim
patch 7.4.2201
Problem: The sign column disappears when the last sign is deleted. Solution: Add the 'signcolumn' option. (Christian Brabandt)
This commit is contained in:
54
src/option.c
54
src/option.c
@@ -253,6 +253,9 @@
|
||||
# define PV_COCU OPT_WIN(WV_COCU)
|
||||
# define PV_COLE OPT_WIN(WV_COLE)
|
||||
#endif
|
||||
#ifdef FEAT_SIGNS
|
||||
# define PV_SCL OPT_WIN(WV_SCL)
|
||||
#endif
|
||||
|
||||
/* WV_ and BV_ values get typecasted to this for the "indir" field */
|
||||
typedef enum
|
||||
@@ -2410,6 +2413,14 @@ static struct vimoption options[] =
|
||||
{"sidescrolloff", "siso", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
|
||||
(char_u *)&p_siso, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
|
||||
{"signcolumn", "scl", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN,
|
||||
#ifdef FEAT_SIGNS
|
||||
(char_u *)VAR_WIN, PV_SCL,
|
||||
{(char_u *)"auto", (char_u *)0L} SCRIPTID_INIT},
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)NULL, (char_u *)0L}
|
||||
#endif
|
||||
{"slowopen", "slow", P_BOOL|P_VI_DEF,
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
|
||||
@@ -3076,6 +3087,9 @@ static char *(p_fcl_values[]) = {"all", NULL};
|
||||
#ifdef FEAT_INS_EXPAND
|
||||
static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "noinsert", "noselect", NULL};
|
||||
#endif
|
||||
#ifdef FEAT_SIGNS
|
||||
static char *(p_scl_values[]) = {"yes", "no", "auto", NULL};
|
||||
#endif
|
||||
|
||||
static void set_option_default(int, int opt_flags, int compatible);
|
||||
static void set_options_default(int opt_flags);
|
||||
@@ -6978,6 +6992,15 @@ did_set_string_option(
|
||||
}
|
||||
#endif /* FEAT_INS_EXPAND */
|
||||
|
||||
#ifdef FEAT_SIGNS
|
||||
/* 'signcolumn' */
|
||||
else if (varp == &curwin->w_p_scl)
|
||||
{
|
||||
if (check_opt_strings(*varp, p_scl_values, FALSE) != OK)
|
||||
errmsg = e_invarg;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
|
||||
else if (varp == &p_toolbar)
|
||||
@@ -10432,6 +10455,9 @@ get_varp(struct vimoption *p)
|
||||
case PV_WM: return (char_u *)&(curbuf->b_p_wm);
|
||||
#ifdef FEAT_KEYMAP
|
||||
case PV_KMAP: return (char_u *)&(curbuf->b_p_keymap);
|
||||
#endif
|
||||
#ifdef FEAT_SIGNS
|
||||
case PV_SCL: return (char_u *)&(curwin->w_p_scl);
|
||||
#endif
|
||||
default: EMSG(_("E356: get_varp ERROR"));
|
||||
}
|
||||
@@ -10548,6 +10574,9 @@ copy_winopt(winopt_T *from, winopt_T *to)
|
||||
to->wo_fdt = vim_strsave(from->wo_fdt);
|
||||
# endif
|
||||
to->wo_fmr = vim_strsave(from->wo_fmr);
|
||||
#endif
|
||||
#ifdef FEAT_SIGNS
|
||||
to->wo_scl = vim_strsave(from->wo_scl);
|
||||
#endif
|
||||
check_winopt(to); /* don't want NULL pointers */
|
||||
}
|
||||
@@ -10578,6 +10607,9 @@ check_winopt(winopt_T *wop UNUSED)
|
||||
# endif
|
||||
check_string_option(&wop->wo_fmr);
|
||||
#endif
|
||||
#ifdef FEAT_SIGNS
|
||||
check_string_option(&wop->wo_scl);
|
||||
#endif
|
||||
#ifdef FEAT_RIGHTLEFT
|
||||
check_string_option(&wop->wo_rlc);
|
||||
#endif
|
||||
@@ -10611,6 +10643,9 @@ clear_winopt(winopt_T *wop UNUSED)
|
||||
# endif
|
||||
clear_string_option(&wop->wo_fmr);
|
||||
#endif
|
||||
#ifdef FEAT_SIGNS
|
||||
clear_string_option(&wop->wo_scl);
|
||||
#endif
|
||||
#ifdef FEAT_LINEBREAK
|
||||
clear_string_option(&wop->wo_briopt);
|
||||
#endif
|
||||
@@ -12274,3 +12309,22 @@ get_bkc_value(buf_T *buf)
|
||||
{
|
||||
return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags;
|
||||
}
|
||||
|
||||
#if defined(FEAT_SIGNS) || defined(PROTO)
|
||||
/*
|
||||
* Return TRUE when window "wp" has a column to draw signs in.
|
||||
*/
|
||||
int
|
||||
signcolumn_on(win_T *wp)
|
||||
{
|
||||
if (*wp->w_p_scl == 'n')
|
||||
return FALSE;
|
||||
if (*wp->w_p_scl == 'y')
|
||||
return TRUE;
|
||||
return (wp->w_buffer->b_signlist != NULL
|
||||
# ifdef FEAT_NETBEANS_INTG
|
||||
|| wp->w_buffer->b_has_sign_column
|
||||
# endif
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user