mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 11:18:19 +00:00
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 vim/vim#4694)
d6bcff4577
This commit is contained in:
@@ -4518,8 +4518,13 @@ static void get_sign_display_info(
|
||||
*c_finalp = NUL;
|
||||
|
||||
if (nrcol) {
|
||||
snprintf((char *)extra, extra_size, "%-*s ",
|
||||
number_width(wp), *pp_extra);
|
||||
int n, width = number_width(wp) - 2;
|
||||
for (n = 0; n < width; n++) {
|
||||
extra[n] = ' ';
|
||||
}
|
||||
extra[n] = NUL;
|
||||
STRCAT(extra, *pp_extra);
|
||||
STRCAT(extra, " ");
|
||||
*pp_extra = extra;
|
||||
*n_extrap = (int)STRLEN(*pp_extra);
|
||||
} else {
|
||||
|
@@ -1765,6 +1765,7 @@ func Test_sign_numcol()
|
||||
set signcolumn=number
|
||||
sign define sign1 text==>
|
||||
sign place 10 line=1 name=sign1
|
||||
sign define sign2 text=V
|
||||
redraw!
|
||||
call assert_equal("=> 01234", s:ScreenLine(1, 1, 8))
|
||||
|
||||
@@ -1844,6 +1845,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(" V abcde", s:ScreenLine(2, 1, 9))
|
||||
|
||||
sign unplace * group=*
|
||||
sign undefine sign1
|
||||
|
Reference in New Issue
Block a user