On Mi, 13 Jan 2016, 'Suresh Govindachar' via vim_use wrote:

> On 1/12/2016 10:48 PM, Christian Brabandt wrote:
> ...
> >
> >    while(textm =~ '^\s*$')  " will always exit from while
> >          ...
> >        let textm = getline(cline-i)
> >    endwhile
> >
> >There is no exit condition, once cline-i is smaller than 1.
> >In that case getline returns an empty string,
> 
> Not according to the documentation for :help getline():
> 
>     When {lnum} is smaller than 1 or bigger than the
>     number of lines in the buffer, an empty string is
>     returned.
> 
> That is the reason for the comment (will always exit from while).

You misunderstood. There is no reason, why the empty string '' should 
not match '^$'. (you can basically omit the \s*)

This has been changed by patch 7.4.129, previously getline(-1) returned 
-1 and that made your loop break.

Best,
Christian
-- 
Nichtstun ist besser als mit viel Mühe nichts schaffen.

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" 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.

Reply via email to