-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
On September 26, 2014 6:10:35 AM GMT+03:00, Tony Mechelynck <
antoine.m...@gmail.com> wrote:
>On 25/09/14 10:24, mattn wrote:
>>> I don't see what you mean with "breakable".
>>
>> Sorry, I was confused. Until Patch 7.4.457, getchar() doesn't return
>"\<CursorHold>". (However 0x80 0xFD was returned)
>>
>> I meant getchar() return only when it used with <expr>.
>>
>>
>> augroup hogehoge
>> autocmd!
>> autocmd CursorHold,CursorHoldI,WinEnter * setlocal cursorline
>> augroup END
>>
>> function! s:foo()
>> let c = 0
>> while c == "\<CursorHold>"
>> let c = getchar()
>> endwhile
>> echomsg c
>> return ''
>> endfunction
>>
>> nnoremap <expr>f <SID>foo()
>>
>
>This function will always echomsg 0 because at the start of the loop, c
>
>is equal to zero which is != "\<CursorHold>"; hence Bram's :let c =
>getchar() just before entering the loop.
Wondering whether you actually tested this. Unless "\<CursorHold>" starts with a number (it does not because all such things start with 0x80) it will be coerced to zero when comparing with numbers. So this loop is OK. I have not actually tested this either though.
>
>Remember that
>
> while (condition)
> DoSomething
> endwhile
>
> is equivalent (in a modified vimscript language using goto's and
>labels) to
>
> start: if (condition)
> DoSomething
> goto start
> endif
>
>
>Best regards,
>Tony.
-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1
iQI1BAEBCgAfBQJUKiGUGBxaeVggPHp5eC52aW1AZ21haWwuY29tPgAKCRCf3UKj
HhHSvlHwEACZBZdXbQ0664w3bN5vybUlYtBqQ2hjvDaWS7nlDZ+Vcw2p37qdmmWw
yZThd6Le0B7dji2ycqqqTR8TRH3cviwJBLjaraeMx59iX3Ipb7ICZ6poryEVRVaX
K1INnzqpqxxOizd+aCVPELtCfriOJ8E1uGgtzumcrdPRzG+uwSoKfrLeoM3LxIS4
OLsXkSxsMpKiLbQxLw0RK30ANXUvkoFYl3QoHZO1F5aeAh8Pw3ONksm7c97zdaRc
C0p+fTbC8KISF6VrqkPQsf5/grtfOSiYjKzrIu00G+6qMyZcrfeDCUyiFhNV/4kl
Xs81zZ50rZqBlpcwmIvACCuEGDwIbAG5mzUxpx/IKSorb8bTOp2B6rR63yRfJ7k0
ND18sYRQrQ/vB1FPxvvzN9Wl/HGajHR+AJNTwTilwUH4Ur6Fugcc9DT0Vy/Ap1TG
YCDyUU24OxSZWK5AY2AdponZjCWxmA6B8D8MayF6KbpBfyhE0ADGV6LBoqKP1Ex1
v8y7793H38316CD2Sn6cE6TYLveDOwTrCXfIhGrWJj6ExAP435drGrPkZuZ1kcGr
pCh4tgdZhfWcc4OYgc5qpbZ8BvoW+hhruH80r1CalTSwS28QDAp4y4kq3Pq/S3AS
kah3Yu4KLsbyVLVvpEp0sjnYypDRjfIfhErW7itRbPODb4YKyXiZKg==
=FqoR
-----END PGP SIGNATURE-----