1
0
forked from aniani/vim

patch 8.1.1712: signs in number column cause text to be misaligned

Problem:    Signs in number column cause text to be misaligned.
Solution:   Improve alignment. (Yasuhiro Matsumoto, closes #4694)
This commit is contained in:
Bram Moolenaar 2019-07-18 12:48:16 +02:00
parent acf7544cf6
commit d6bcff4577
3 changed files with 16 additions and 2 deletions

View File

@ -3120,8 +3120,13 @@ get_sign_display_info(
{
if (nrcol)
{
sprintf((char *)extra, "%*s ", number_width(wp),
*pp_extra);
int n, width = number_width(wp) - 2;
for (n = 0; n < width; n++)
extra[n] = ' ';
extra[n] = 0;
STRCAT(extra, *pp_extra);
STRCAT(extra, " ");
*pp_extra = extra;
}
*c_extrap = NUL;

View File

@ -1766,6 +1766,7 @@ func Test_sign_numcol()
set number
set signcolumn=number
sign define sign1 text==>
sign define sign2 text=
sign place 10 line=1 name=sign1
redraw!
call assert_equal("=> 01234", s:ScreenLine(1, 1, 8))
@ -1846,6 +1847,12 @@ func Test_sign_numcol()
redraw!
call assert_equal("=> 01234", s:ScreenLine(1, 1, 8))
call assert_equal(" 2 abcde", s:ScreenLine(2, 1, 8))
" Add sign with multi-byte text
set numberwidth=4
sign place 40 line=2 name=sign2
redraw!
call assert_equal(" => 01234", s:ScreenLine(1, 1, 9))
call assert_equal(" abcde", s:ScreenLine(2, 1, 9))
sign unplace * group=*
sign undefine sign1

View File

@ -777,6 +777,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1712,
/**/
1711,
/**/