refactor(sign): store 'signcolumn' width range when it is set

Problem:  Minimum and maximum signcolumn width is determined each redraw.
Solution: Determine and store 'signcolumn' range when option is set.
This commit is contained in:
Luuk van Baal
2023-11-20 02:27:16 +01:00
committed by Lewis Russell
parent fec5e3ab24
commit 585eeacb24
7 changed files with 56 additions and 69 deletions

View File

@@ -442,7 +442,9 @@ void decor_redraw_signs(win_T *wp, buf_T *buf, int row, SignTextAttrs sattrs[],
int *cul_id, int *num_id)
{
MarkTreeIter itr[1];
if (!buf->b_signs || !marktree_itr_get_overlap(buf->b_marktree, row, 0, itr)) {
if (!buf->b_signs
|| wp->w_minscwidth == SCL_NO
|| !marktree_itr_get_overlap(buf->b_marktree, row, 0, itr)) {
return;
}
@@ -471,7 +473,7 @@ void decor_redraw_signs(win_T *wp, buf_T *buf, int row, SignTextAttrs sattrs[],
}
if (kv_size(signs)) {
int width = (*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u') ? 1 : wp->w_scwidth;
int width = wp->w_minscwidth == SCL_NUM ? 1 : wp->w_scwidth;
int idx = MIN(width, num_text) - 1;
qsort((void *)&kv_A(signs, 0), kv_size(signs), sizeof(MTKey), sign_cmp);