On Fri, Jan 1, 2016 at 2:22 AM, Bram Moolenaar <[email protected]> wrote:
>
> 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.
>
I agree.
> 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?
>
searchpos('$', 'nc') does not match at cursor position when cursor is at
end of line.
Maybe we can use some workaround for it in a script. But I just thought
that this behavior is a bit strange.
--
Yukihiro Nakadaira - [email protected]
--
--
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.