From d3eddcf630f29da72409934eb14fb7a534f6497e Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 11 Jul 2020 13:13:49 +0900 Subject: vim-patch:8.1.1564: sign column takes up space Problem: Sign column takes up space. (Adam Stankiewicz) Solution: Optionally put signs in the number column. (Yegappan Lakshmanan, closes vim/vim#4555, closes vim/vim#4515) https://github.com/vim/vim/commit/394c5d8870b15150fc91a4c058dc571fd5eaa97e --- src/nvim/testdir/test_signs.vim | 59 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim index 8b1927e4f0..f89095ec5d 100644 --- a/src/nvim/testdir/test_signs.vim +++ b/src/nvim/testdir/test_signs.vim @@ -6,6 +6,8 @@ endif source screendump.vim +set noswapfile + func Test_sign() new call setline(1, ['a', 'b', 'c', 'd']) @@ -1742,3 +1744,60 @@ func Test_sign_cursor_position() call StopVimInTerminal(buf) call delete('XtestSigncolumn') endfunc + +" Return the 'len' characters in screen starting from (row,col) +func s:ScreenLine(row, col, len) + let s = '' + for i in range(a:len) + let s .= nr2char(screenchar(a:row, a:col + i)) + endfor + return s +endfunc + +" Test for 'signcolumn' set to 'number'. +func Test_sign_numcol() + new + call append(0, "01234") + " With 'signcolumn' set to 'number', make sure sign is displayed in the + " number column and line number is not displayed. + set numberwidth=2 + set number + set signcolumn=number + sign define sign1 text==> + sign place 10 line=1 name=sign1 + redraw! + call assert_equal("=> 01234", s:ScreenLine(1, 1, 8)) + + " With 'signcolumn' set to 'number', when there is no sign, make sure line + " number is displayed in the number column + sign unplace 10 + redraw! + call assert_equal("1 01234", s:ScreenLine(1, 1, 7)) + + " Disable number column. Check whether sign is displayed in the sign column + set numberwidth=4 + set nonumber + sign place 10 line=1 name=sign1 + redraw! + call assert_equal("=>01234", s:ScreenLine(1, 1, 7)) + + " Enable number column. Check whether sign is displayed in the number column + set number + redraw! + call assert_equal("=> 01234", s:ScreenLine(1, 1, 9)) + + " Disable sign column. Make sure line number is displayed + set signcolumn=no + redraw! + call assert_equal(" 1 01234", s:ScreenLine(1, 1, 9)) + + " Enable auto sign column. Make sure both sign and line number are displayed + set signcolumn=auto + redraw! + call assert_equal("=> 1 01234", s:ScreenLine(1, 1, 11)) + + sign undefine sign1 + set signcolumn& + set number& + enew! | close +endfunc -- cgit From bfe94d0a0814eab5e9f9b6c6b06e770ba904da9f Mon Sep 17 00:00:00 2001 From: erw7 Date: Tue, 14 Jul 2020 05:15:04 +0900 Subject: vim-patch:8.1.1623: display wrong with signs in narrow number column Problem: Display wrong with signs in narrow number column. Solution: Increase the numbercolumn width if needed. (Yegappan Lakshmanan, closes vim/vim#4606) https://github.com/vim/vim/commit/e4b407f536ba8bd007152649a347a95320d80fce --- src/nvim/testdir/test_signs.vim | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim index f89095ec5d..9d1146453a 100644 --- a/src/nvim/testdir/test_signs.vim +++ b/src/nvim/testdir/test_signs.vim @@ -1796,6 +1796,56 @@ func Test_sign_numcol() redraw! call assert_equal("=> 1 01234", s:ScreenLine(1, 1, 11)) + " Test displaying signs in the number column with width 1 + call sign_unplace('*') + call append(1, "abcde") + call append(2, "01234") + " Enable number column with width 1 + set number numberwidth=1 signcolumn=auto + redraw! + call assert_equal("3 01234", s:ScreenLine(3, 1, 7)) + " Place a sign and make sure number column width remains the same + sign place 20 line=2 name=sign1 + redraw! + call assert_equal("=>2 abcde", s:ScreenLine(2, 1, 9)) + call assert_equal(" 3 01234", s:ScreenLine(3, 1, 9)) + " Set 'signcolumn' to 'number', make sure the number column width increases + set signcolumn=number + redraw! + call assert_equal("=> abcde", s:ScreenLine(2, 1, 8)) + call assert_equal(" 3 01234", s:ScreenLine(3, 1, 8)) + " Set 'signcolumn' to 'auto', make sure the number column width is 1. + set signcolumn=auto + redraw! + call assert_equal("=>2 abcde", s:ScreenLine(2, 1, 9)) + call assert_equal(" 3 01234", s:ScreenLine(3, 1, 9)) + " Set 'signcolumn' to 'number', make sure the number column width is 2. + set signcolumn=number + redraw! + call assert_equal("=> abcde", s:ScreenLine(2, 1, 8)) + call assert_equal(" 3 01234", s:ScreenLine(3, 1, 8)) + " Disable 'number' column + set nonumber + redraw! + call assert_equal("=>abcde", s:ScreenLine(2, 1, 7)) + call assert_equal(" 01234", s:ScreenLine(3, 1, 7)) + " Enable 'number' column + set number + redraw! + call assert_equal("=> abcde", s:ScreenLine(2, 1, 8)) + call assert_equal(" 3 01234", s:ScreenLine(3, 1, 8)) + " Remove the sign and make sure the width of the number column is 1. + call sign_unplace('', {'id' : 20}) + redraw! + call assert_equal("3 01234", s:ScreenLine(3, 1, 7)) + " When the first sign is placed with 'signcolumn' set to number, verify that + " the number column width increases + sign place 30 line=1 name=sign1 + redraw! + call assert_equal("=> 01234", s:ScreenLine(1, 1, 8)) + call assert_equal(" 2 abcde", s:ScreenLine(2, 1, 8)) + + sign unplace * group=* sign undefine sign1 set signcolumn& set number& -- cgit From 6b521ceeaf7dd3ad3169355c1c106139291e82e8 Mon Sep 17 00:00:00 2001 From: erw7 Date: Tue, 14 Jul 2020 05:13:26 +0900 Subject: 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) https://github.com/vim/vim/commit/d6bcff457799e491c3d27880858ec08e758e1849 --- src/nvim/testdir/test_signs.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim index 9d1146453a..48a885c0a1 100644 --- a/src/nvim/testdir/test_signs.vim +++ b/src/nvim/testdir/test_signs.vim @@ -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 -- cgit From 1647e0a5b306dc6767a5298c8a9281a0fc7ace14 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 11 Jul 2020 13:13:49 +0900 Subject: vim-patch:8.1.1564: sign column takes up space Problem: Sign column takes up space. (Adam Stankiewicz) Solution: Optionally put signs in the number column. (Yegappan Lakshmanan, closes vim/vim#4555, closes vim/vim#4515) https://github.com/vim/vim/commit/394c5d8870b15150fc91a4c058dc571fd5eaa97e --- src/nvim/testdir/test_signs.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim index 48a885c0a1..3dad290c94 100644 --- a/src/nvim/testdir/test_signs.vim +++ b/src/nvim/testdir/test_signs.vim @@ -6,6 +6,7 @@ endif source screendump.vim +" Note: In neovim, swapfile feature must be disabled set noswapfile func Test_sign() -- cgit From 73340c1ce2ac44acd1604536ab9097f19b62e4ae Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Tue, 14 Jul 2020 23:12:27 +0900 Subject: vim-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 vim/vim#4559) https://github.com/vim/vim/commit/4dff4aed09d2b0d570ca0d19de9cb08bdf03e695 --- src/nvim/testdir/test_signs.vim | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim index 3dad290c94..2b7672f1af 100644 --- a/src/nvim/testdir/test_signs.vim +++ b/src/nvim/testdir/test_signs.vim @@ -6,9 +6,6 @@ endif source screendump.vim -" Note: In neovim, swapfile feature must be disabled -set noswapfile - func Test_sign() new call setline(1, ['a', 'b', 'c', 'd']) @@ -1786,7 +1783,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 -- cgit