Sunday, August 25, 2013

Re: redraw crashes on android


On Aug 25, 2013 10:57 PM, "Tony Mechelynck" <antoine.mechelynck@gmail.com> wrote:
>
> On 25/08/13 20:45, Nikolay Pavlov wrote:
>>
>>
>> On Aug 25, 2013 10:36 PM, "Liang Li" <q335r49@gmail.com
>> <mailto:q335r49@gmail.com>> wrote:
>>  >
>>  > Hey guys, this is sort of an obscure problem, I'm not sure if you
>> have any suggestions. I'm running vim 7.3.3 (locally) on an android
>> phone, via Connectbot, and I'm getting a crash that can't be reproduced
>> on a computer due to redr!, maybe because of memory constraints or
>> something. For example, the following script will crash my phone after
>> about 3 seconds
>>
>> Why not use some more recent version? There were plenty of bug fixes.
>>
>>  > while 1
>>  >         if reltime()[1]%2
>>  >         exe "norm! \<c-e>"
>>  >         else
>>  >         exe "norm! \<c-y>"
>>  >         en
>>  >         redr!
>>  > endwhile
>>  >
>>  > On the "verbose" error log I get an "Interrupted" message and it
>> jumps straight into my VimLeavePre autocommmands. I'm mostly looking for
>> a work-around or any suggestions as to how to avoid this, or whether
>> it's possible to do a safer redraw, etc. Try / catch, for example,
>> doesn't work.
>>
>> Try setting 'nolazyredraw'. This should cause normally omitted redraws
>> while script is running. I have no other idea how to cause a redraw
>> except for :execute "normal!\<C-l>", which should not make any difference.
>
>
> There is also :redraw (or :redraw! to clear the screen before redrawing). See :help :redraw

:redraw! causes a crash, :redraw seemed to do nothing for me any time I tried. The question was a safer way to redraw, :redraw! was already mentioned in the first message and I assumed that :redraw was also tested and proved to be just as useless for OP like it was for me.

The "and I'm getting a crash that can't be reproduced on a computer due to redr!" is the place where :redraw was mentioned.

>>
>>  > The actual script I'm working on, if this is relevant, is a mouse
>> panning thing, a la Adobe reader:
>>  >
>>  > nn <silent> <leftmouse> :call getchar()<cr><leftmouse>:exe
>> (MousePan()==1? "keepj norm! \<lt>leftmouse>":"")<cr>
>>  >         let
>> glidestep=[99999999]+map(range(11),'11*(11-v:val)*(11-v:val)')
>>  >         fun! MousePan()
>>  >                 if v:mouse_lnum>line('w$') || (&wrap &&
>> v:mouse_col%winwidth(0)==1) || (!&wrap &&
>> v:mouse_col>=winwidth(0)+winsaveview().leftcol) || v:mouse_lnum==line('$')
>>  >                         if line('$')==line('w0') | exe "keepj norm!
>> \<c-y>" |en
>>  >                         return 1 | en
>>  >                 exe "norm! \<leftmouse>"
>>  >                 let
>> [veon,fr,tl,dvl,dhl]=[&ve==?'all',-1,repeat([reltime()],4),[0,0,0,0],[0,0,0,0]]
>>  >                 let v=winsaveview()
>>  >                 let [v.col,v.coladd]=[0,v.curswant]
>>  >                 while getchar()=="\<leftdrag>"
>>  >                         let
>> [dV,dH,fr]=[min([v:mouse_lnum-v.lnum,v.topline-1]),
>> min([veon*(v:mouse_col-v.coladd-1),v.leftcol]),(fr+1)%4]
>>  >                         let
>> [v.topline,v.leftcol,v.lnum,v.coladd,tl[fr],dvl[fr],dhl[fr]]=[v.topline-dV,v.leftcol-dH,v:mouse_lnum-dV,v:mouse_col-1-dH,reltime(),dV,dH]
>>  >                         call winrestview(v)
>>  >                         redr!
>>  >                 endwhile
>>  >                 let
>> [sv,sh]=[dvl[0]+dvl[1]+dvl[2]+dvl[3],dhl[0]+dhl[1]+dhl[2]+dhl[3]]
>>  >                 let [ctl,cln,sv]=sv>2?
>> ['-(v.topline>1)','-(v.lnum>1)',sv+10] : sv<-2?
>> ['v.topline<'.line('$'),'v.lnum<'.line('$'),-sv+10] :
>> ['-(v.topline>1)','-(v.lnum>1)',0]
>>  >                 let [clc,cca,sh,vc,hc]=sh>2?
>> ['-(v.leftcol>0)','-(v.coladd>0)',sh+10,0,0] : sh<-2?
>> ['1','1',-sh+10,0,0] : ['1','1',0,0,0]
>>  >                 if !eval(join(reltime(tl[(fr+1)%4]),' || 20000<')) ||
>> !sv && !sh | return | en
>>  >                 while !getchar(1) && sv+sh>0
>>  >                         let
>> [y,x,vc,hc]=[vc>get(g:glidestep,sv,1),hc>get(g:glidestep,sh,1),vc+1,hc+1]
>>  >                         if y+x
>>  >                                 let [v.topline,v.lnum,sv,vc]+=y?
>> [eval(ctl),eval(cln),-1,-vc] : [0,0,0,0]
>>  >                                 let [v.leftcol,v.coladd,sh,hc]+=x?
>> [eval(clc),eval(cca),-1,-hc] : [0,0,0,0]
>>  >                                 call winrestview(v)
>>  >                                 redr!
>>  >                         en
>>  >                 endw
>>  >         endfun
>>  >
>
>
>
> Best regards,
> Tony.
> --
> FORTH IF HONK THEN
>
>
>
> --
> --
> 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/groups/opt_out.

--
--
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/groups/opt_out.

No comments: