vim-patch:7.4.2201

Problem:    The sign column disappears when the last sign is deleted.
Solution:   Add the 'signcolumn' option. (Christian Brabandt)

95ec9d6a6a
This commit is contained in:
Chris Lucas
2016-10-29 17:04:13 -07:00
committed by James McCoy
parent d467104816
commit 99a8cd3be0
10 changed files with 55 additions and 22 deletions

View File

@@ -237,6 +237,8 @@ typedef struct {
# define w_p_crb w_onebuf_opt.wo_crb /* 'cursorbind' */
int wo_crb_save; /* 'cursorbind' state saved for diff mode*/
# define w_p_crb_save w_onebuf_opt.wo_crb_save
char_u *wo_scl;
# define w_p_scl w_onebuf_opt.wo_scl /* 'signcolumn' */
int wo_scriptID[WV_COUNT]; /* SIDs for window-local options */
# define w_p_scriptID w_onebuf_opt.wo_scriptID

View File

@@ -5708,7 +5708,7 @@ comp_textwidth (
textwidth -= 1;
textwidth -= curwin->w_p_fdc;
if (curwin->w_buffer->b_signlist != NULL) {
if (signcolumn_on(curwin)) {
textwidth -= 1;
}

View File

@@ -24,6 +24,7 @@
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/misc1.h"
#include "nvim/option.h"
#include "nvim/popupmnu.h"
#include "nvim/screen.h"
#include "nvim/strings.h"
@@ -669,7 +670,7 @@ int win_col_off(win_T *wp)
return ((wp->w_p_nu || wp->w_p_rnu) ? number_width(wp) + 1 : 0)
+ (cmdwin_type == 0 || wp != curwin ? 0 : 1)
+ (int)wp->w_p_fdc
+ (wp->w_buffer->b_signlist != NULL ? 2 : 0)
+ (signcolumn_on(wp) ? 2 : 0)
;
}

View File

@@ -289,6 +289,7 @@ static char *(p_fcl_values[]) = { "all", NULL };
static char *(p_cot_values[]) = { "menu", "menuone", "longest", "preview",
"noinsert", "noselect", NULL };
static char *(p_icm_values[]) = { "nosplit", "split", NULL };
static char *(p_scl_values[]) = { "yes", "no", "auto", NULL };
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "option.c.generated.h"
@@ -3008,6 +3009,12 @@ did_set_string_option (
completeopt_was_set();
}
}
/* 'signcolumn' */
else if (varp == &curwin->w_p_scl) {
if (check_opt_strings(*varp, p_scl_values, false) != OK) {
errmsg = e_invarg;
}
}
/* 'pastetoggle': translate key codes like in a mapping */
else if (varp == &p_pt) {
if (*p_pt) {
@@ -4782,7 +4789,6 @@ static int find_key_option(const char_u *arg)
return find_key_option_len(arg, STRLEN(arg));
}
/*
* if 'all' == 0: show changed options
* if 'all' == 1: show all normal options
@@ -5428,6 +5434,7 @@ static char_u *get_varp(vimoption_T *p)
case PV_UDF: return (char_u *)&(curbuf->b_p_udf);
case PV_WM: return (char_u *)&(curbuf->b_p_wm);
case PV_KMAP: return (char_u *)&(curbuf->b_p_keymap);
case PV_SCL: return (char_u *)&(curwin->w_p_scl);
default: EMSG(_("E356: get_varp ERROR"));
}
/* always return a valid pointer to avoid a crash! */
@@ -5505,6 +5512,7 @@ void copy_winopt(winopt_T *from, winopt_T *to)
to->wo_fde = vim_strsave(from->wo_fde);
to->wo_fdt = vim_strsave(from->wo_fdt);
to->wo_fmr = vim_strsave(from->wo_fmr);
to->wo_scl = vim_strsave(from->wo_scl);
check_winopt(to); /* don't want NULL pointers */
}
@@ -5528,6 +5536,7 @@ static void check_winopt(winopt_T *wop)
check_string_option(&wop->wo_fde);
check_string_option(&wop->wo_fdt);
check_string_option(&wop->wo_fmr);
check_string_option(&wop->wo_scl);
check_string_option(&wop->wo_rlc);
check_string_option(&wop->wo_stl);
check_string_option(&wop->wo_cc);
@@ -5546,6 +5555,7 @@ void clear_winopt(winopt_T *wop)
clear_string_option(&wop->wo_fde);
clear_string_option(&wop->wo_fdt);
clear_string_option(&wop->wo_fmr);
clear_string_option(&wop->wo_scl);
clear_string_option(&wop->wo_rlc);
clear_string_option(&wop->wo_stl);
clear_string_option(&wop->wo_cc);
@@ -6902,3 +6912,14 @@ int csh_like_shell(void)
return strstr((char *)path_tail(p_sh), "csh") != NULL;
}
/// Return true when window "wp" has a column to draw signs in.
bool 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;
}

View File

@@ -799,6 +799,7 @@ enum {
, WV_WFH
, WV_WFW
, WV_WRAP
, WV_SCL
, WV_COUNT /* must be the last one */
};

View File

@@ -2169,6 +2169,14 @@ return {
varname='p_siso',
defaults={if_true={vi=0}}
},
{
full_name='signcolumn', abbreviation='scl',
type='string', scope={'window'},
vi_def=true,
alloced=true,
redraw={'current_window'},
defaults={if_true={vi="auto"}}
},
{
full_name='smartcase', abbreviation='scs',
type='bool', scope={'global'},

View File

@@ -575,15 +575,6 @@ void update_debug_sign(buf_T *buf, linenr_T lnum)
update_finish();
}
/*
* 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);
}
/*
* Update a single window.
*
@@ -1598,7 +1589,7 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h
' ', ' ', hl_attr(HLF_FC));
}
if (draw_signcolumn(wp)) {
if (signcolumn_on(wp)) {
int nn = n + 2;
/* draw the sign column left of the fold column */
@@ -1639,7 +1630,7 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h
n = nn;
}
if (draw_signcolumn(wp))
if (signcolumn_on(wp))
{
int nn = n + 2;
@@ -1753,7 +1744,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T
RL_MEMSET(col, hl_attr(HLF_FL), wp->w_width - col);
/* If signs are being displayed, add two spaces. */
if (draw_signcolumn(wp)) {
if (signcolumn_on(wp)) {
len = wp->w_width - col;
if (len > 0) {
if (len > 2) {
@@ -2701,7 +2692,7 @@ win_line (
draw_state = WL_SIGN;
/* Show the sign column when there are any signs in this
* buffer or when using Netbeans. */
if (draw_signcolumn(wp)) {
if (signcolumn_on(wp)) {
int text_sign;
/* Draw two cells with the sign value or blank. */
c_extra = ' ';

View File

@@ -239,7 +239,7 @@ static int included_patches[] = {
// 2204,
// 2203 NA
// 2202 NA
// 2201,
2201,
// 2200,
// 2199 NA
// 2198,