mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
Merge pull request #14391 from lewis6991/signs
signs: Change b_signcols_max -> b_signcols_valid
This commit is contained in:
@@ -1786,7 +1786,7 @@ buf_T *buflist_new(char_u *ffname_arg, char_u *sfname_arg, linenr_T lnum,
|
|||||||
buf = xcalloc(1, sizeof(buf_T));
|
buf = xcalloc(1, sizeof(buf_T));
|
||||||
// init b: variables
|
// init b: variables
|
||||||
buf->b_vars = tv_dict_alloc();
|
buf->b_vars = tv_dict_alloc();
|
||||||
buf->b_signcols_max = -1;
|
buf->b_signcols_valid = false;
|
||||||
init_var_dict(buf->b_vars, &buf->b_bufvar, VAR_SCOPE);
|
init_var_dict(buf->b_vars, &buf->b_bufvar, VAR_SCOPE);
|
||||||
buf_init_changedtick(buf);
|
buf_init_changedtick(buf);
|
||||||
}
|
}
|
||||||
@@ -5547,16 +5547,16 @@ bool find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp)
|
|||||||
|
|
||||||
int buf_signcols(buf_T *buf)
|
int buf_signcols(buf_T *buf)
|
||||||
{
|
{
|
||||||
if (buf->b_signcols_max == -1) {
|
if (!buf->b_signcols_valid) {
|
||||||
sign_entry_T *sign; // a sign in the sign list
|
sign_entry_T *sign; // a sign in the sign list
|
||||||
buf->b_signcols_max = 0;
|
int signcols = 0;
|
||||||
int linesum = 0;
|
int linesum = 0;
|
||||||
linenr_T curline = 0;
|
linenr_T curline = 0;
|
||||||
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign) {
|
FOR_ALL_SIGNS_IN_BUF(buf, sign) {
|
||||||
if (sign->se_lnum > curline) {
|
if (sign->se_lnum > curline) {
|
||||||
if (linesum > buf->b_signcols_max) {
|
if (linesum > signcols) {
|
||||||
buf->b_signcols_max = linesum;
|
signcols = linesum;
|
||||||
}
|
}
|
||||||
curline = sign->se_lnum;
|
curline = sign->se_lnum;
|
||||||
linesum = 0;
|
linesum = 0;
|
||||||
@@ -5565,15 +5565,17 @@ int buf_signcols(buf_T *buf)
|
|||||||
linesum++;
|
linesum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (linesum > buf->b_signcols_max) {
|
if (linesum > signcols) {
|
||||||
buf->b_signcols_max = linesum;
|
signcols = linesum;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we need to redraw
|
// Check if we need to redraw
|
||||||
if (buf->b_signcols_max != buf->b_signcols) {
|
if (signcols != buf->b_signcols) {
|
||||||
buf->b_signcols = buf->b_signcols_max;
|
buf->b_signcols = signcols;
|
||||||
redraw_buf_later(buf, NOT_VALID);
|
redraw_buf_later(buf, NOT_VALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buf->b_signcols_valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return buf->b_signcols;
|
return buf->b_signcols;
|
||||||
|
@@ -849,8 +849,8 @@ struct file_buffer {
|
|||||||
// may use a different synblock_T.
|
// may use a different synblock_T.
|
||||||
|
|
||||||
sign_entry_T *b_signlist; // list of placed signs
|
sign_entry_T *b_signlist; // list of placed signs
|
||||||
int b_signcols_max; // cached maximum number of sign columns
|
|
||||||
int b_signcols; // last calculated number of sign columns
|
int b_signcols; // last calculated number of sign columns
|
||||||
|
bool b_signcols_valid; // calculated sign columns is valid
|
||||||
|
|
||||||
Terminal *terminal; // Terminal instance associated with the buffer
|
Terminal *terminal; // Terminal instance associated with the buffer
|
||||||
|
|
||||||
|
@@ -194,7 +194,7 @@ static void insert_sign(
|
|||||||
if (next != NULL) {
|
if (next != NULL) {
|
||||||
next->se_prev = newsign;
|
next->se_prev = newsign;
|
||||||
}
|
}
|
||||||
buf->b_signcols_max = -1;
|
buf->b_signcols_valid = false;
|
||||||
|
|
||||||
if (prev == NULL) {
|
if (prev == NULL) {
|
||||||
// When adding first sign need to redraw the windows to create the
|
// When adding first sign need to redraw the windows to create the
|
||||||
@@ -534,7 +534,7 @@ linenr_T buf_delsign(
|
|||||||
sign_entry_T *next; // the next sign in a b_signlist
|
sign_entry_T *next; // the next sign in a b_signlist
|
||||||
linenr_T lnum; // line number whose sign was deleted
|
linenr_T lnum; // line number whose sign was deleted
|
||||||
|
|
||||||
buf->b_signcols_max = -1;
|
buf->b_signcols_valid = false;
|
||||||
lastp = &buf->b_signlist;
|
lastp = &buf->b_signlist;
|
||||||
lnum = 0;
|
lnum = 0;
|
||||||
for (sign = buf->b_signlist; sign != NULL; sign = next) {
|
for (sign = buf->b_signlist; sign != NULL; sign = next) {
|
||||||
@@ -668,7 +668,7 @@ void buf_delete_signs(buf_T *buf, char_u *group)
|
|||||||
lastp = &sign->se_next;
|
lastp = &sign->se_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf->b_signcols_max = -1;
|
buf->b_signcols_valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// List placed signs for "rbuf". If "rbuf" is NULL do it for all buffers.
|
/// List placed signs for "rbuf". If "rbuf" is NULL do it for all buffers.
|
||||||
@@ -735,7 +735,7 @@ void sign_mark_adjust(
|
|||||||
int is_fixed = 0;
|
int is_fixed = 0;
|
||||||
int signcol = win_signcol_configured(curwin, &is_fixed);
|
int signcol = win_signcol_configured(curwin, &is_fixed);
|
||||||
|
|
||||||
curbuf->b_signcols_max = -1;
|
curbuf->b_signcols_valid = false;
|
||||||
lastp = &curbuf->b_signlist;
|
lastp = &curbuf->b_signlist;
|
||||||
|
|
||||||
for (sign = curbuf->b_signlist; sign != NULL; sign = next) {
|
for (sign = curbuf->b_signlist; sign != NULL; sign = next) {
|
||||||
|
Reference in New Issue
Block a user