Skip to content

Commit 4dff4ae

Browse files
committed
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)
1 parent bf8c3ad commit 4dff4ae

4 files changed

Lines changed: 34 additions & 8 deletions

File tree

src/gui.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,6 +2253,7 @@ gui_outstr_nowrap(
22532253
int col = gui.col;
22542254
#ifdef FEAT_SIGN_ICONS
22552255
int draw_sign = FALSE;
2256+
char_u extra[18];
22562257
# ifdef FEAT_NETBEANS_INTG
22572258
int multi_sign = FALSE;
22582259
# endif
@@ -2275,10 +2276,17 @@ gui_outstr_nowrap(
22752276
multi_sign = TRUE;
22762277
# endif
22772278
/* draw spaces instead */
2278-
s = (char_u *)" ";
2279+
if (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) == 'u' &&
2280+
(curwin->w_p_nu || curwin->w_p_rnu))
2281+
{
2282+
sprintf((char *)extra, "%*c ", number_width(curwin), ' ');
2283+
s = extra;
2284+
}
2285+
else
2286+
s = (char_u *)" ";
22792287
if (len == 1 && col > 0)
22802288
--col;
2281-
len = 2;
2289+
len = (int)STRLEN(s);
22822290
draw_sign = TRUE;
22832291
highlight_mask = 0;
22842292
}

src/screen.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3088,15 +3088,31 @@ get_sign_display_info(
30883088
if (gui.in_use && icon_sign != 0)
30893089
{
30903090
// Use the image in this position.
3091-
*c_extrap = SIGN_BYTE;
3092-
*c_finalp = NUL;
3091+
if (nrcol)
3092+
{
3093+
*c_extrap = NUL;
3094+
sprintf((char *)extra, "%-*c ", number_width(wp), SIGN_BYTE);
3095+
*pp_extra = extra;
3096+
*n_extrap = (int)STRLEN(*pp_extra);
3097+
}
3098+
else
3099+
*c_extrap = SIGN_BYTE;
30933100
# ifdef FEAT_NETBEANS_INTG
30943101
if (buf_signcount(wp->w_buffer, lnum) > 1)
30953102
{
3096-
*c_extrap = MULTISIGN_BYTE;
3097-
*c_finalp = NUL;
3103+
if (nrcol)
3104+
{
3105+
*c_extrap = NUL;
3106+
sprintf((char *)extra, "%-*c ", number_width(wp),
3107+
MULTISIGN_BYTE);
3108+
*pp_extra = extra;
3109+
*n_extrap = (int)STRLEN(*pp_extra);
3110+
}
3111+
else
3112+
*c_extrap = MULTISIGN_BYTE;
30983113
}
30993114
# endif
3115+
*c_finalp = NUL;
31003116
*char_attrp = icon_sign;
31013117
}
31023118
else
@@ -3108,7 +3124,7 @@ get_sign_display_info(
31083124
{
31093125
if (nrcol)
31103126
{
3111-
sprintf((char *)extra, "%-*s ", number_width(wp),
3127+
sprintf((char *)extra, "%*s ", number_width(wp),
31123128
*pp_extra);
31133129
*pp_extra = extra;
31143130
}

src/testdir/test_signs.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ func Test_sign_numcol()
17761776
" Enable number column. Check whether sign is displayed in the number column
17771777
set number
17781778
redraw!
1779-
call assert_equal("=> 01234", s:ScreenLine(1, 1, 9))
1779+
call assert_equal(" => 01234", s:ScreenLine(1, 1, 9))
17801780

17811781
" Disable sign column. Make sure line number is displayed
17821782
set signcolumn=no

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,8 @@ static char *(features[]) =
777777

778778
static int included_patches[] =
779779
{ /* Add new patch number below this line */
780+
/**/
781+
1570,
780782
/**/
781783
1569,
782784
/**/

0 commit comments

Comments
 (0)