1
0
forked from aniani/vim

patch 8.1.2269: tags file with very long line stops using binary search

Problem:    Tags file with very long line stops using binary search.
Solution:   Reallocate the buffer if needed.
This commit is contained in:
Bram Moolenaar
2019-11-07 23:08:42 +01:00
parent 3d2a47c782
commit dc9ef26845
3 changed files with 41 additions and 25 deletions

View File

@@ -459,7 +459,8 @@ func Test_tag_line_toolong()
call assert_report(v:exception)
catch /.*/
endtry
call assert_equal('Ignoring long line in tags file', split(execute('messages'), '\n')[-1])
call assert_equal('Searching tags file Xtags', split(execute('messages'), '\n')[-1])
call writefile([
\ '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 django/contrib/admin/templates/admin/edit_inline/stacked.html 16;" j line:16 language:HTML'
\ ], 'Xtags')
@@ -470,8 +471,26 @@ func Test_tag_line_toolong()
call assert_report(v:exception)
catch /.*/
endtry
call assert_equal('Ignoring long line in tags file', split(execute('messages'), '\n')[-1])
call assert_equal('Searching tags file Xtags', split(execute('messages'), '\n')[-1])
" binary search works in file with long line
call writefile([
\ 'asdfasfd nowhere 16',
\ 'foobar Xsomewhere 3; " 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567',
\ 'zasdfasfd nowhere 16',
\ ], 'Xtags')
call writefile([
\ 'one',
\ 'two',
\ 'trhee',
\ 'four',
\ ], 'Xsomewhere')
tag foobar
call assert_equal('Xsomewhere', expand('%'))
call assert_equal(3, getcurpos()[1])
call delete('Xtags')
call delete('Xsomewhere')
set tags&
let &verbose = old_vbs
endfunc