2014-06-02 0:01 GMT+04:00 Bram Moolenaar <b...@moolenaar.net>:

>
> Alexey Radkov wrote:
>
> > A new version: next_search_hl_pos() moved into next_search_hl().
> > A number of fixes added.
> > Docs were added too, here is an excerpt:
> >
> > matchaddpos({group}, {pos}[, {priority}[, {id}]])        *matchaddpos()*
> >         Same as |matchadd()|, but requires a list of positions {pos}
> >         instead of a pattern. This command is faster than |matchadd()|
> >         because it does not require to handle regular expressions and
> >         sets buffer line boundaries to redraw screen. It is supposed
> >         to be used when fast match additions and deletions are
> >         required, for example to highlight matching parentheses.
> >
> >         The list {pos} accepts sublists: positions like [23, 24] or
> >         plain numbers like 34. In the first case the 24th character in
> >         line 23 will be highlighted; in the second case the whole line
> >         34 will be highlighted. Maximum number of positions is 8.
> >
> >         Example: >
> >             :highlight MyGroup ctermbg=green guibg=green
> >             :let m = matchaddpos("MyGroup", [[23, 24], 34])
> > <        Deletion of the pattern: >
> >             :call matchdelete(m)
>
> I would suggest a third argument: the number of columns to highlight.
> So it's [lnum, col, length].  When length is missing highlight one
> screen cell, when col is missing highlight the whole line. I think
> that's flexible enough.
>

Implemented


> > Still no tests, will add them soon.
>
> OK, I will wait for that.
>

About tests. Here is what i added into test63.in:

:" --- Check that "matchaddpos()" positions match correctly
:let @r .= "*** Test 11: "
:call append(0, 'test()')
:call matchaddpos("MyGroup1", [[1, 5], [1, 6]], 10, 3)
:let v1 = screenattr(1, 1)
:let v2 = screenattr(1, 5)
:let v3 = screenattr(1, 6)
:let @r .= v1."\n"
:let @r .= v2."\n"
:let @r .= v3."\n"
:if v1 != v2 && v2 == v3
:  let @r .= "OK\n"
:else
:  let @r .= "FAILED\n"
:endif
:call clearmatches()
:unlet v1
:unlet v2
:unlet v3

Run

VIMRUNTIME=../../runtime; export VIMRUNTIME;  ../vim -u unix.vim -U NONE
--noplugin -s dotest.in test63.in. Result:

Results of test63:
*** Test 1: OK
*** Test 2: OK
*** Test 3: OK
*** Test 4: OK
*** Test 5: OK
*** Test 6: OK
*** Test 7: OK
*** Test 8: OK
*** Test 9: OK
*** Test 10: OK
*** Test 11: 0
0
0
FAILED

I remember that when vim is running in scripting mode as well as when its
stdin is not a terminal it won't actually apply color attributes and
screenattr() will always get 0. If it's true then screenattr() is not
suitable here... (Though i see that it is used in test101.in). Anyway this
test work when i ran it from vim manually.


>
> --
> hundred-and-one symptoms of being an internet addict:
> 251. You've never seen your closest friends who usually live WAY too far
> away.
>
>  /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net
> \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/
> \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org
>  ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org
>  ///
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui