Mercurial > vim
comparison src/testdir/test_tabline.vim @ 21417:53ff4dfe6e11 v8.2.1259
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Commit: https://github.com/vim/vim/commit/f56c95fdad5af521887f8cd7bc15729b5355231d
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jul 21 19:25:18 2020 +0200
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Problem: Empty group in 'tabline' may cause using an invalid pointer.
Solution: Set the group start position. (closes https://github.com/vim/vim/issues/6505)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 21 Jul 2020 19:30:04 +0200 |
parents | 0650d220f742 |
children | 08940efa6b4e |
comparison
equal
deleted
inserted
replaced
21416:0adf0004085a | 21417:53ff4dfe6e11 |
---|---|
110 call assert_match('^ Xtabline1 Xtabline2\s\+close$', Screenline(1)) | 110 call assert_match('^ Xtabline1 Xtabline2\s\+close$', Screenline(1)) |
111 set tabline= | 111 set tabline= |
112 %bw! | 112 %bw! |
113 endfunc | 113 endfunc |
114 | 114 |
115 function EmptyTabname() | |
116 return "" | |
117 endfunction | |
118 | |
119 function MakeTabLine() abort | |
120 let titles = map(range(1, tabpagenr('$')), '"%( %" . v:val . "T%{EmptyTabname()}%T %)"') | |
121 let sep = 'あ' | |
122 let tabpages = join(titles, sep) | |
123 return tabpages .. sep .. '%=%999X X' | |
124 endfunction | |
125 | |
126 func Test_tabline_empty_group() | |
127 " this was reading invalid memory | |
128 set tabline=%!MakeTabLine() | |
129 tabnew | |
130 redraw! | |
131 | |
132 tabclose | |
133 set tabline= | |
134 endfunc | |
135 | |
136 | |
137 | |
115 " vim: shiftwidth=2 sts=2 expandtab | 138 " vim: shiftwidth=2 sts=2 expandtab |