On Fri, August 6, 2010 5:05 am, Yue Wu wrote:
> Create a func:
>
> func! Ywtest()
> redraw | let txt = matchstr(input("Foo: "), '^\s*\zs.*')
> while txt == ''
> let txt = matchstr(input("Foo: "), '^\s*\zs')
> endwhile
> endfunc
>
> Run it: :call Ywtest()
>
> Then in the first prompt, hit enter to enter a blank string, then func
> will
> prompt again, now input some string, hit enter again, you will find the
> while
> loop will nerver end from now on.
>
> If I remove the matchstr() part, func runs well, what's wrong with it?
Because your pattern always matches and since you are using \zs at the
end of your pattern, matchstr() will always return the empty string.
regards,
Christian
--
You received this message from the "vim_use" 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