man.vim: workaround for 'cscopetag' #11679

The old `:Man` implementation would take either the word under
the cursor, or the argument passed in, and load that as a man page.

Since we now use 'tagfunc' and look for all relevant man-pages, if
your system has several (i.e. same name, different sections), we return
several, giving the user an option.

This works for most tag commands except `:tjump`, which will
fail if there's multiple tags to choose from. This just happens to
be what the cscope code uses (it actually attempts to prompt the
user, but this fails).
This commit is contained in:
Rob Pilling 2020-01-07 05:57:36 +00:00 committed by Justin M. Keyes
parent 83b0054b87
commit 4a7d84ae60

View File

@ -398,6 +398,11 @@ function! man#goto_tag(pattern, flags, info) abort
" sort by relevance - exact matches first, then the previous order
call sort(l:structured, { a, b -> a.name ==? l:name ? -1 : b.name ==? l:name ? 1 : 0 })
if &cscopetag
" return only a single entry so we work well with :cstag (#11675)
let l:structured = l:structured[:0]
endif
return map(l:structured, {
\ _, entry -> {
\ 'name': entry.name,