Yukihiro Nakadaira wrote:
> In insert mode, searchpos('$') skips first match.
>
> Steps to reproduce:
> $ vim -u NONE -N
> :call setline(1, ['abc', 'abc', 'abc'])
> :call cursor(2, 3)
> :inoremap <expr> S S()
> :function! S()
> : echo searchpos('$', 'n')
> : return ''
> :endfunction
> iS
> [3, 4]
>
> =====buffer=====
> 1: a b c
>
> 2: a b|c
> ^cursor
> 3: a b c
> ^matched
> ================
>
> I think this sould be matched at [2, 4].
> I wrote patch for this problem.
> Please check the attached patch.
Hmm, I'm not so sure if having searchpos() behave slightly differently
in Insert mode is a good idea.
If you want to accept a match at the cursor position, then use the 'c'
flag:
echo searchpos('$', 'nc')
Is there is a reason this would not be a good solution?
--
BLACK KNIGHT: I move for no man.
ARTHUR: So be it!
[hah] [parry thrust]
[ARTHUR chops the BLACK KNIGHT's left arm off]
ARTHUR: Now stand aside, worthy adversary.
BLACK KNIGHT: 'Tis but a scratch.
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- [email protected] -- 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 [email protected].
For more options, visit https://groups.google.com/d/optout.