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:
@@ -1,4 +1,4 @@
|
|||||||
*options.txt* For Vim version 7.4. Last change: 2016 Jul 29
|
*options.txt* For Vim version 7.4. Last change: 2016 Aug 12
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -261,10 +261,10 @@ global value, which is used for new buffers. With ":set" both the local and
|
|||||||
global value is changed. With "setlocal" only the local value is changed,
|
global value is changed. With "setlocal" only the local value is changed,
|
||||||
thus this value is not used when editing a new buffer.
|
thus this value is not used when editing a new buffer.
|
||||||
|
|
||||||
When editing a buffer that has been edited before, the last used window
|
When editing a buffer that has been edited before, the options from the window
|
||||||
options are used again. If this buffer has been edited in this window, the
|
that was last closed are used again. If this buffer has been edited in this
|
||||||
values from back then are used. Otherwise the values from the window where
|
window, the values from back then are used. Otherwise the values from the
|
||||||
the buffer was edited last are used.
|
last closed window where the buffer was edited last are used.
|
||||||
|
|
||||||
It's possible to set a local window option specifically for a type of buffer.
|
It's possible to set a local window option specifically for a type of buffer.
|
||||||
When you edit another buffer in the same window, you don't want to keep
|
When you edit another buffer in the same window, you don't want to keep
|
||||||
@@ -6733,10 +6733,19 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
|
|
||||||
Example: Try this together with 'sidescroll' and 'listchars' as
|
Example: Try this together with 'sidescroll' and 'listchars' as
|
||||||
in the following example to never allow the cursor to move
|
in the following example to never allow the cursor to move
|
||||||
onto the "extends" character:
|
onto the "extends" character: >
|
||||||
|
|
||||||
:set nowrap sidescroll=1 listchars=extends:>,precedes:<
|
:set nowrap sidescroll=1 listchars=extends:>,precedes:<
|
||||||
:set sidescrolloff=1
|
:set sidescrolloff=1
|
||||||
|
<
|
||||||
|
*'signcolumn'* *'scl'*
|
||||||
|
'signcolumn' 'scl' string (default "auto")
|
||||||
|
local to window
|
||||||
|
{not in Vi}
|
||||||
|
{not available when compiled without the |+signs|
|
||||||
|
feature}
|
||||||
|
Whether or not to draw the signcolumn. "auto" means it will only be
|
||||||
|
drawn when there is a sign to display.
|
||||||
|
|
||||||
|
|
||||||
*'smartcase'* *'scs'* *'nosmartcase'* *'noscs'*
|
*'smartcase'* *'scs'* *'nosmartcase'* *'noscs'*
|
||||||
|
@@ -1307,6 +1307,11 @@ call append("$", "\t(local to buffer)")
|
|||||||
call <SID>BinOptionL("bl")
|
call <SID>BinOptionL("bl")
|
||||||
call append("$", "debug\tset to \"msg\" to see all error messages")
|
call append("$", "debug\tset to \"msg\" to see all error messages")
|
||||||
call append("$", " \tset debug=" . &debug)
|
call append("$", " \tset debug=" . &debug)
|
||||||
|
if has("signs")
|
||||||
|
call append("$", "signcolumn\twhether to show the signcolumn")
|
||||||
|
call append("$", "\t(local to window)")
|
||||||
|
call <SID>OptionL("scl")
|
||||||
|
endif
|
||||||
if has("mzscheme")
|
if has("mzscheme")
|
||||||
call append("$", "mzquantum\tinterval in milliseconds between polls for MzScheme threads")
|
call append("$", "mzquantum\tinterval in milliseconds between polls for MzScheme threads")
|
||||||
call append("$", " \tset mzq=" . &mzq)
|
call append("$", " \tset mzq=" . &mzq)
|
||||||
|
@@ -6761,11 +6761,7 @@ comp_textwidth(
|
|||||||
textwidth -= curwin->w_p_fdc;
|
textwidth -= curwin->w_p_fdc;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_SIGNS
|
#ifdef FEAT_SIGNS
|
||||||
if (curwin->w_buffer->b_signlist != NULL
|
if (signcolumn_on(curwin))
|
||||||
# ifdef FEAT_NETBEANS_INTG
|
|
||||||
|| curwin->w_buffer->b_has_sign_column
|
|
||||||
# endif
|
|
||||||
)
|
|
||||||
textwidth -= 1;
|
textwidth -= 1;
|
||||||
#endif
|
#endif
|
||||||
if (curwin->w_p_nu || curwin->w_p_rnu)
|
if (curwin->w_p_nu || curwin->w_p_rnu)
|
||||||
|
@@ -890,12 +890,7 @@ win_col_off(win_T *wp)
|
|||||||
+ wp->w_p_fdc
|
+ wp->w_p_fdc
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_SIGNS
|
#ifdef FEAT_SIGNS
|
||||||
+ (
|
+ (signcolumn_on(wp) ? 2 : 0)
|
||||||
# ifdef FEAT_NETBEANS_INTG
|
|
||||||
/* show glyph gutter in netbeans */
|
|
||||||
wp->w_buffer->b_has_sign_column ||
|
|
||||||
# endif
|
|
||||||
wp->w_buffer->b_signlist != NULL ? 2 : 0)
|
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
54
src/option.c
54
src/option.c
@@ -253,6 +253,9 @@
|
|||||||
# define PV_COCU OPT_WIN(WV_COCU)
|
# define PV_COCU OPT_WIN(WV_COCU)
|
||||||
# define PV_COLE OPT_WIN(WV_COLE)
|
# define PV_COLE OPT_WIN(WV_COLE)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_SIGNS
|
||||||
|
# define PV_SCL OPT_WIN(WV_SCL)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* WV_ and BV_ values get typecasted to this for the "indir" field */
|
/* WV_ and BV_ values get typecasted to this for the "indir" field */
|
||||||
typedef enum
|
typedef enum
|
||||||
@@ -2410,6 +2413,14 @@ static struct vimoption options[] =
|
|||||||
{"sidescrolloff", "siso", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
|
{"sidescrolloff", "siso", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
|
||||||
(char_u *)&p_siso, PV_NONE,
|
(char_u *)&p_siso, PV_NONE,
|
||||||
{(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
|
{(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,
|
{"slowopen", "slow", P_BOOL|P_VI_DEF,
|
||||||
(char_u *)NULL, PV_NONE,
|
(char_u *)NULL, PV_NONE,
|
||||||
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
|
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
|
||||||
@@ -3076,6 +3087,9 @@ static char *(p_fcl_values[]) = {"all", NULL};
|
|||||||
#ifdef FEAT_INS_EXPAND
|
#ifdef FEAT_INS_EXPAND
|
||||||
static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "noinsert", "noselect", NULL};
|
static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "noinsert", "noselect", NULL};
|
||||||
#endif
|
#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_option_default(int, int opt_flags, int compatible);
|
||||||
static void set_options_default(int opt_flags);
|
static void set_options_default(int opt_flags);
|
||||||
@@ -6978,6 +6992,15 @@ did_set_string_option(
|
|||||||
}
|
}
|
||||||
#endif /* FEAT_INS_EXPAND */
|
#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)
|
#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
|
||||||
else if (varp == &p_toolbar)
|
else if (varp == &p_toolbar)
|
||||||
@@ -10432,6 +10455,9 @@ get_varp(struct vimoption *p)
|
|||||||
case PV_WM: return (char_u *)&(curbuf->b_p_wm);
|
case PV_WM: return (char_u *)&(curbuf->b_p_wm);
|
||||||
#ifdef FEAT_KEYMAP
|
#ifdef FEAT_KEYMAP
|
||||||
case PV_KMAP: return (char_u *)&(curbuf->b_p_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
|
#endif
|
||||||
default: EMSG(_("E356: get_varp ERROR"));
|
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);
|
to->wo_fdt = vim_strsave(from->wo_fdt);
|
||||||
# endif
|
# endif
|
||||||
to->wo_fmr = vim_strsave(from->wo_fmr);
|
to->wo_fmr = vim_strsave(from->wo_fmr);
|
||||||
|
#endif
|
||||||
|
#ifdef FEAT_SIGNS
|
||||||
|
to->wo_scl = vim_strsave(from->wo_scl);
|
||||||
#endif
|
#endif
|
||||||
check_winopt(to); /* don't want NULL pointers */
|
check_winopt(to); /* don't want NULL pointers */
|
||||||
}
|
}
|
||||||
@@ -10578,6 +10607,9 @@ check_winopt(winopt_T *wop UNUSED)
|
|||||||
# endif
|
# endif
|
||||||
check_string_option(&wop->wo_fmr);
|
check_string_option(&wop->wo_fmr);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_SIGNS
|
||||||
|
check_string_option(&wop->wo_scl);
|
||||||
|
#endif
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
check_string_option(&wop->wo_rlc);
|
check_string_option(&wop->wo_rlc);
|
||||||
#endif
|
#endif
|
||||||
@@ -10611,6 +10643,9 @@ clear_winopt(winopt_T *wop UNUSED)
|
|||||||
# endif
|
# endif
|
||||||
clear_string_option(&wop->wo_fmr);
|
clear_string_option(&wop->wo_fmr);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_SIGNS
|
||||||
|
clear_string_option(&wop->wo_scl);
|
||||||
|
#endif
|
||||||
#ifdef FEAT_LINEBREAK
|
#ifdef FEAT_LINEBREAK
|
||||||
clear_string_option(&wop->wo_briopt);
|
clear_string_option(&wop->wo_briopt);
|
||||||
#endif
|
#endif
|
||||||
@@ -12274,3 +12309,22 @@ get_bkc_value(buf_T *buf)
|
|||||||
{
|
{
|
||||||
return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags;
|
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
|
||||||
|
@@ -633,6 +633,9 @@ EXTERN int p_magic; /* 'magic' */
|
|||||||
EXTERN char_u *p_mef; /* 'makeef' */
|
EXTERN char_u *p_mef; /* 'makeef' */
|
||||||
EXTERN char_u *p_mp; /* 'makeprg' */
|
EXTERN char_u *p_mp; /* 'makeprg' */
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_SIGNS
|
||||||
|
EXTERN char_u *p_scl; /* signcolumn */
|
||||||
|
#endif
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
EXTERN char_u *p_cc; /* 'colorcolumn' */
|
EXTERN char_u *p_cc; /* 'colorcolumn' */
|
||||||
EXTERN int p_cc_cols[256]; /* array for 'colorcolumn' columns */
|
EXTERN int p_cc_cols[256]; /* array for 'colorcolumn' columns */
|
||||||
@@ -1173,6 +1176,9 @@ enum
|
|||||||
, WV_WFW
|
, WV_WFW
|
||||||
#endif
|
#endif
|
||||||
, WV_WRAP
|
, WV_WRAP
|
||||||
|
#ifdef FEAT_SIGNS
|
||||||
|
, WV_SCL
|
||||||
|
#endif
|
||||||
, WV_COUNT /* must be the last one */
|
, WV_COUNT /* must be the last one */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -63,4 +63,5 @@ long get_sw_value(buf_T *buf);
|
|||||||
long get_sts_value(void);
|
long get_sts_value(void);
|
||||||
void find_mps_values(int *initc, int *findc, int *backwards, int switchit);
|
void find_mps_values(int *initc, int *findc, int *backwards, int switchit);
|
||||||
unsigned int get_bkc_value(buf_T *buf);
|
unsigned int get_bkc_value(buf_T *buf);
|
||||||
|
int signcolumn_on(win_T *wp);
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
25
src/screen.c
25
src/screen.c
@@ -2255,23 +2255,6 @@ win_update(win_T *wp)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_SIGNS
|
|
||||||
static int draw_signcolumn(win_T *wp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return TRUE when window "wp" has a column to draw signs in.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
draw_signcolumn(win_T *wp)
|
|
||||||
{
|
|
||||||
return (wp->w_buffer->b_signlist != NULL
|
|
||||||
# ifdef FEAT_NETBEANS_INTG
|
|
||||||
|| wp->w_buffer->b_has_sign_column
|
|
||||||
# endif
|
|
||||||
);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear the rest of the window and mark the unused lines with "c1". use "c2"
|
* Clear the rest of the window and mark the unused lines with "c1". use "c2"
|
||||||
* as the filler character.
|
* as the filler character.
|
||||||
@@ -2313,7 +2296,7 @@ win_draw_end(
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_SIGNS
|
# ifdef FEAT_SIGNS
|
||||||
if (draw_signcolumn(wp))
|
if (signcolumn_on(wp))
|
||||||
{
|
{
|
||||||
int nn = n + 2;
|
int nn = n + 2;
|
||||||
|
|
||||||
@@ -2363,7 +2346,7 @@ win_draw_end(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_SIGNS
|
#ifdef FEAT_SIGNS
|
||||||
if (draw_signcolumn(wp))
|
if (signcolumn_on(wp))
|
||||||
{
|
{
|
||||||
int nn = n + 2;
|
int nn = n + 2;
|
||||||
|
|
||||||
@@ -2507,7 +2490,7 @@ fold_line(
|
|||||||
|
|
||||||
#ifdef FEAT_SIGNS
|
#ifdef FEAT_SIGNS
|
||||||
/* If signs are being displayed, add two spaces. */
|
/* If signs are being displayed, add two spaces. */
|
||||||
if (draw_signcolumn(wp))
|
if (signcolumn_on(wp))
|
||||||
{
|
{
|
||||||
len = W_WIDTH(wp) - col;
|
len = W_WIDTH(wp) - col;
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
@@ -3677,7 +3660,7 @@ win_line(
|
|||||||
draw_state = WL_SIGN;
|
draw_state = WL_SIGN;
|
||||||
/* Show the sign column when there are any signs in this
|
/* Show the sign column when there are any signs in this
|
||||||
* buffer or when using Netbeans. */
|
* buffer or when using Netbeans. */
|
||||||
if (draw_signcolumn(wp))
|
if (signcolumn_on(wp))
|
||||||
{
|
{
|
||||||
int text_sign;
|
int text_sign;
|
||||||
# ifdef FEAT_SIGN_ICONS
|
# ifdef FEAT_SIGN_ICONS
|
||||||
|
@@ -263,6 +263,10 @@ typedef struct
|
|||||||
int wo_crb_save; /* 'cursorbind' state saved for diff mode*/
|
int wo_crb_save; /* 'cursorbind' state saved for diff mode*/
|
||||||
# define w_p_crb_save w_onebuf_opt.wo_crb_save
|
# define w_p_crb_save w_onebuf_opt.wo_crb_save
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_SIGNS
|
||||||
|
char_u *wo_scl;
|
||||||
|
# define w_p_scl w_onebuf_opt.wo_scl /* 'signcolumn' */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
int wo_scriptID[WV_COUNT]; /* SIDs for window-local options */
|
int wo_scriptID[WV_COUNT]; /* SIDs for window-local options */
|
||||||
|
@@ -16,7 +16,7 @@ function! Test_whichwrap()
|
|||||||
set whichwrap&
|
set whichwrap&
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! Test_options()
|
function Test_options()
|
||||||
let caught = 'ok'
|
let caught = 'ok'
|
||||||
try
|
try
|
||||||
options
|
options
|
||||||
@@ -29,7 +29,7 @@ function! Test_options()
|
|||||||
close
|
close
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! Test_path_keep_commas()
|
function Test_path_keep_commas()
|
||||||
" Test that changing 'path' keeps two commas.
|
" Test that changing 'path' keeps two commas.
|
||||||
set path=foo,,bar
|
set path=foo,,bar
|
||||||
set path-=bar
|
set path-=bar
|
||||||
@@ -38,3 +38,11 @@ function! Test_path_keep_commas()
|
|||||||
|
|
||||||
set path&
|
set path&
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
func Test_signcolumn()
|
||||||
|
call assert_equal("auto", &signcolumn)
|
||||||
|
set signcolumn=yes
|
||||||
|
set signcolumn=no
|
||||||
|
call assert_fails('set signcolumn=nope')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
@@ -763,6 +763,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2201,
|
||||||
/**/
|
/**/
|
||||||
2200,
|
2200,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user