James McCoy wrote:

> On Wed, Nov 01, 2017 at 09:22:45PM +0100, Bram Moolenaar wrote:
> > That's defenitely better than an arbitrary delay.  However, I think your
> > check just never matches and causes a delay of one second.
> 
> That's surprising that WaitFor() silently fails, but you are right.

Yeah, the idea is that that caller checks the returned value, but in
practice that never happens.  It's better to throw an exception on
timeout.  When I do that I find several places where the expression is
wrong.

> I tested this patch and it does work:
> > 
> > diff --git i/src/testdir/test_popup.vim w/src/testdir/test_popup.vim
> > index 2781aabcd..0746efc7f 100644
> > --- i/src/testdir/test_popup.vim
> > +++ w/src/testdir/test_popup.vim
> > @@ -637,9 +637,11 @@ func Test_popup_and_window_resize()
> >    if h < 15
> >      return
> >    endif
> > -  let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set 
> > noswapfile'], {'term_rows': h / 3})
> > +  let rows = h / 3
> > +  let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set 
> > noswapfile'], {'term_rows': rows})
> >    call term_sendkeys(g:buf, (h / 3 - 1)."o\<esc>")
> > -  call term_wait(g:buf, 500)
> > +  " Wait for the nested Vim to exit insert mode, where it will show the 
> > ruler
> > +  call WaitFor(printf('term_getline(g:buf, %d) =~ "\<%d,.*Bot"', rows, 
> > rows))
> >    call term_sendkeys(g:buf, "Gi\<c-x>")
> >    call term_sendkeys(g:buf, "\<c-v>")
> >    call term_wait(g:buf, 100)

Now that WaitFor() throws an error I see this doesn't work.  At least an
explicit redraw appears to be needed.

Ah, the backslash needs to be doubled.

-- 
Every exit is an entrance into something else.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to