]> granicus.if.org Git - vim/commitdiff
patch 8.1.1570: icon signs not displayed properly in the number column v8.1.1570
authorBram Moolenaar <Bram@vim.org>
Wed, 19 Jun 2019 14:31:28 +0000 (16:31 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 19 Jun 2019 14:31:28 +0000 (16:31 +0200)
Problem:    Icon signs not displayed properly in the number column.
Solution:   Display them properly. (Yegappan Lakshmanan, closes #4559)

src/gui.c
src/screen.c
src/testdir/test_signs.vim
src/version.c

index a4673f02664712425960247464af61ed6f0d7b17..56891822773e9718c64b04a280ac17c845e71f04 100644 (file)
--- a/src/gui.c
+++ b/src/gui.c
@@ -2253,6 +2253,7 @@ gui_outstr_nowrap(
     int                col = gui.col;
 #ifdef FEAT_SIGN_ICONS
     int                draw_sign = FALSE;
+    char_u     extra[18];
 # ifdef FEAT_NETBEANS_INTG
     int                multi_sign = FALSE;
 # endif
@@ -2275,10 +2276,17 @@ gui_outstr_nowrap(
            multi_sign = TRUE;
 # endif
        /* draw spaces instead */
-       s = (char_u *)"  ";
+       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 *)"  ";
        if (len == 1 && col > 0)
            --col;
-       len = 2;
+       len = (int)STRLEN(s);
        draw_sign = TRUE;
        highlight_mask = 0;
     }
index 914bf37c3aeab0bccdd2f5e746ce54759fe22cee..05639c30b70e1a550b2db1d9570dadba6a47b038 100644 (file)
@@ -3088,15 +3088,31 @@ get_sign_display_info(
        if (gui.in_use && icon_sign != 0)
        {
            // Use the image in this position.
-           *c_extrap = SIGN_BYTE;
-           *c_finalp = NUL;
+           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;
 #  ifdef FEAT_NETBEANS_INTG
            if (buf_signcount(wp->w_buffer, lnum) > 1)
            {
-               *c_extrap = MULTISIGN_BYTE;
-               *c_finalp = NUL;
+               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;
            }
 #  endif
+           *c_finalp = NUL;
            *char_attrp = icon_sign;
        }
        else
@@ -3108,7 +3124,7 @@ get_sign_display_info(
                {
                    if (nrcol)
                    {
-                       sprintf((char *)extra, "%-*s ", number_width(wp),
+                       sprintf((char *)extra, "%*s ", number_width(wp),
                                                                *pp_extra);
                        *pp_extra = extra;
                    }
index 1435e8683e6480261a369c49cdced90ed64d4ba8..c979804a80b22114ad8226741c1733deee1acdce 100644 (file)
@@ -1776,7 +1776,7 @@ func Test_sign_numcol()
   " Enable number column. Check whether sign is displayed in the number column
   set number
   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
   set signcolumn=no
index 7e97f9147bdafa30d431999b3bc57f5282dd9698..d71b86e13faaa6bc8a7a3f627459e30a4823f113 100644 (file)
@@ -777,6 +777,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1570,
 /**/
     1569,
 /**/