On Dec 30, 1:18 am, "Balazs Kezes" <[EMAIL PROTECTED]> wrote:
> Hi!
...
>
> " Jumps to the next tag in ||.
> " If dir[ection] is nonzero it jumps forwards, if zero backwards.
> " It doesn't wrap at the end of the file.
> function! GetNextHelpTag(dir)
> if a:dir != 0
> let flags = "sW"
> else
> let flags = "bsW"
> endif
>
> " Save the original position for the case we didn't find a tag.
> let ori_pos = getpos('.')
>
> " For every possible match check if it is a tag for sure
> while 1
> let [lnum, col] = searchpos('|.\{-1,}|', flags)
If this doesn't pass in the first run, the '-mark will have no usefull
position.
> if lnum == 0
> break
> endif
> let tag = matchlist(getline('.'), '|\(.\{-1,}\)|', col-1)[1]
> if !empty(taglist(tag))
Should be
if !empty(taglist('^\V'.escape(tag,'\').'\$'))
, because we are searching for a exact match of a string.
Without escaping strings with backslash could produce an
regex error.
> return
> endif
> endwhile
>
> call setpos('.', ori_pos)
> echo "No more tags found."
> endfunction
>
> map <buffer> <Tab> :call GetNextHelpTag(1)<CR>
> map <buffer> <C-Tab> :call GetNextHelpTag(0)<CR>
> map <buffer> <S-Tab> :call GetNextHelpTag(0)<CR>
>
> Without hopes,
> Balazs
Confirming that the string between bars is indeed a valid tag
takes considerably time and results in lag in case the <TAB>
key is held down.
I think we should simply search for the next tag with the regex
from the syntax file. This should be correct in most cases and
if not, it would be the fault of the helpfile author.
Btw beeing able to comprehend a API and make use of it, shows
that your hopelessness is unjustified.
-ap
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---