diff options
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r-- | src/nvim/screen.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 138736f31b..28a1b65fff 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -621,6 +621,11 @@ static void win_update(win_T *wp) linenr_T mod_bot = 0; int save_got_int; + // If we can compute a change in the automatic sizing of the sign column + // under 'signcolumn=auto:X' and signs currently placed in the buffer, better + // figuring it out here so we can redraw the entire screen for it. + buf_signcols(buf); + type = wp->w_redr_type; win_grid_alloc(wp); @@ -1568,8 +1573,9 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h wp->w_grid.Columns, ' ', ' ', win_hl_attr(wp, HLF_FC)); } - if (signcolumn_on(wp)) { - int nn = n + win_signcol_width(wp); + int count = win_signcol_count(wp); + if (count > 0) { + int nn = n + win_signcol_width(wp) * count; // draw the sign column left of the fold column if (nn > wp->w_grid.Columns) { @@ -1607,8 +1613,9 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h n = nn; } - if (signcolumn_on(wp)) { - int nn = n + win_signcol_width(wp); + int count = win_signcol_count(wp); + if (count > 0) { + int nn = n + win_signcol_width(wp) * count; // draw the sign column after the fold column if (nn > wp->w_grid.Columns) { @@ -1773,10 +1780,10 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T RL_MEMSET(col, win_hl_attr(wp, HLF_FL), wp->w_grid.Columns - col); // If signs are being displayed, add spaces. - if (signcolumn_on(wp)) { + if (win_signcol_count(wp) > 0) { len = wp->w_grid.Columns - col; if (len > 0) { - int len_max = win_signcol_width(wp); + int len_max = win_signcol_width(wp) * win_signcol_count(wp); if (len > len_max) { len = len_max; } @@ -2404,7 +2411,7 @@ win_line ( } // If this line has a sign with line highlighting set line_attr. - v = buf_getsigntype(wp->w_buffer, lnum, SIGN_LINEHL); + v = buf_getsigntype(wp->w_buffer, lnum, SIGN_LINEHL, 0, 1); if (v != 0) { line_attr = sign_get_attr((int)v, SIGN_LINEHL); } @@ -2654,6 +2661,7 @@ win_line ( extra_check = true; } + int sign_idx = 0; // Repeat for the whole displayed line. for (;; ) { has_match_conc = 0; @@ -2694,7 +2702,8 @@ win_line ( draw_state = WL_SIGN; /* Show the sign column when there are any signs in this * buffer or when using Netbeans. */ - if (signcolumn_on(wp)) { + int count = win_signcol_count(wp); + if (count > 0) { int text_sign; // Draw cells with the sign value or blank. c_extra = ' '; @@ -2703,7 +2712,8 @@ win_line ( n_extra = win_signcol_width(wp); if (row == startrow + filler_lines && filler_todo <= 0) { - text_sign = buf_getsigntype(wp->w_buffer, lnum, SIGN_TEXT); + text_sign = buf_getsigntype(wp->w_buffer, lnum, SIGN_TEXT, + sign_idx, count); if (text_sign != 0) { p_extra = sign_get_text(text_sign); int symbol_blen = (int)STRLEN(p_extra); @@ -2721,6 +2731,11 @@ win_line ( char_attr = sign_get_attr(text_sign, SIGN_TEXT); } } + + sign_idx++; + if (sign_idx < count) { + draw_state = WL_SIGN - 1; + } } } @@ -2769,7 +2784,8 @@ win_line ( n_extra = number_width(wp) + 1; char_attr = win_hl_attr(wp, HLF_N); - int num_sign = buf_getsigntype(wp->w_buffer, lnum, SIGN_NUMHL); + int num_sign = buf_getsigntype(wp->w_buffer, lnum, SIGN_NUMHL, + 0, 1); if (num_sign != 0) { // :sign defined with "numhl" highlight. char_attr = sign_get_attr(num_sign, SIGN_NUMHL); @@ -2856,6 +2872,7 @@ win_line ( } if (draw_state == WL_LINE - 1 && n_extra == 0) { + sign_idx = 0; draw_state = WL_LINE; if (saved_n_extra) { /* Continue item from end of wrapped line. */ |