0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.1.1570: icon signs not displayed properly in the number column

Problem:    Icon signs not displayed properly in the number column.
Solution:   Display them properly. (Yegappan Lakshmanan, closes #4559)
This commit is contained in:
Bram Moolenaar
2019-06-19 16:31:28 +02:00
parent bf8c3adef2
commit 4dff4aed09
4 changed files with 34 additions and 8 deletions

View File

@@ -2253,6 +2253,7 @@ gui_outstr_nowrap(
int col = gui.col; int col = gui.col;
#ifdef FEAT_SIGN_ICONS #ifdef FEAT_SIGN_ICONS
int draw_sign = FALSE; int draw_sign = FALSE;
char_u extra[18];
# ifdef FEAT_NETBEANS_INTG # ifdef FEAT_NETBEANS_INTG
int multi_sign = FALSE; int multi_sign = FALSE;
# endif # endif
@@ -2275,10 +2276,17 @@ gui_outstr_nowrap(
multi_sign = TRUE; multi_sign = TRUE;
# endif # endif
/* draw spaces instead */ /* draw spaces instead */
if (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) == 'u' &&
(curwin->w_p_nu || curwin->w_p_rnu))
{
sprintf((char *)extra, "%*c ", number_width(curwin), ' ');
s = extra;
}
else
s = (char_u *)" "; s = (char_u *)" ";
if (len == 1 && col > 0) if (len == 1 && col > 0)
--col; --col;
len = 2; len = (int)STRLEN(s);
draw_sign = TRUE; draw_sign = TRUE;
highlight_mask = 0; highlight_mask = 0;
} }

View File

@@ -3088,15 +3088,31 @@ get_sign_display_info(
if (gui.in_use && icon_sign != 0) if (gui.in_use && icon_sign != 0)
{ {
// Use the image in this position. // Use the image in this position.
if (nrcol)
{
*c_extrap = NUL;
sprintf((char *)extra, "%-*c ", number_width(wp), SIGN_BYTE);
*pp_extra = extra;
*n_extrap = (int)STRLEN(*pp_extra);
}
else
*c_extrap = SIGN_BYTE; *c_extrap = SIGN_BYTE;
*c_finalp = NUL;
# ifdef FEAT_NETBEANS_INTG # ifdef FEAT_NETBEANS_INTG
if (buf_signcount(wp->w_buffer, lnum) > 1) if (buf_signcount(wp->w_buffer, lnum) > 1)
{ {
if (nrcol)
{
*c_extrap = NUL;
sprintf((char *)extra, "%-*c ", number_width(wp),
MULTISIGN_BYTE);
*pp_extra = extra;
*n_extrap = (int)STRLEN(*pp_extra);
}
else
*c_extrap = MULTISIGN_BYTE; *c_extrap = MULTISIGN_BYTE;
*c_finalp = NUL;
} }
# endif # endif
*c_finalp = NUL;
*char_attrp = icon_sign; *char_attrp = icon_sign;
} }
else else
@@ -3108,7 +3124,7 @@ get_sign_display_info(
{ {
if (nrcol) if (nrcol)
{ {
sprintf((char *)extra, "%-*s ", number_width(wp), sprintf((char *)extra, "%*s ", number_width(wp),
*pp_extra); *pp_extra);
*pp_extra = extra; *pp_extra = extra;
} }

View File

@@ -1776,7 +1776,7 @@ func Test_sign_numcol()
" Enable number column. Check whether sign is displayed in the number column " Enable number column. Check whether sign is displayed in the number column
set number set number
redraw! redraw!
call assert_equal("=> 01234", s:ScreenLine(1, 1, 9)) call assert_equal(" => 01234", s:ScreenLine(1, 1, 9))
" Disable sign column. Make sure line number is displayed " Disable sign column. Make sure line number is displayed
set signcolumn=no set signcolumn=no

View File

@@ -777,6 +777,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 */
/**/
1570,
/**/ /**/
1569, 1569,
/**/ /**/