Wednesday, January 13, 2016

Re: Try this with release gvim74-1024.exe

On Thu, Jan 14, 2016 at 4:10 AM, 'Suresh Govindachar' via vim_use
<vim_use@googlegroups.com> wrote:
> On 1/13/2016 7:23 AM, Christian Brabandt wrote:
> ...
>>
>> This has been changed by patch 7.4.129, previously getline(-1)
>
>> returned -1 and that made your loop break.
>
> (In case anyone else stumbles into this issue, prior to patch 7.4.129,
> getline(-1) returned 0 -- which is a bug,
> https://github.com/ignatenkobrain/vim-rpm/blob/master/7.4.129 ).
>
> And my script was making use of this bug -- in more ways than one because
> just making the while loop exit did not result in folds.
>
> Unfortunately, for the time-being, my quickfix is to modify
> autoload/notes.vim by introducing:
>
> function! s:mygetline( num )
> if( a:num < 0 ) | return 0 | endif
> return getline( a:num )
> endfunction
>
> and replacing all other instances of getline() with mygetline().
>
> Thanks,
>
> --Suresh

You could even make that function one line shorter (but not more
elegant) by taking advantage of the fact that when there is no
explicit return, the return value is the number zero, as follows:

function s:mygetline(a:num)
if a:num > 0 | return getline(a:num) | endif
endfunction

This assumes that when a:num is zero you want 0, not "" , to be
returned. If you do want the empty string as s:mygetline(0), replace
the condition by a:num >= 0


Best regards,
Tony.

--
--
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment