Re: Patch 8.0.1241

2017-11-02 Fir de Conversatie Bram Moolenaar

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\")
> > -  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\")
> >call term_sendkeys(g:buf, "\")
> >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.


Re: Patch 8.0.1241

2017-11-01 Fir de Conversatie James McCoy
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.  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\")
-  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\")
   call term_sendkeys(g:buf, "\")
   call term_wait(g:buf, 100)

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB

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


Re: Patch 8.0.1241

2017-11-01 Fir de Conversatie Bram Moolenaar

James McCoy wrote:

> On Tue, Oct 31, 2017 at 10:20:14PM +0100, Bram Moolenaar wrote:
> > *** ../vim-8.0.1240/src/testdir/test_popup.vim  2017-10-27 
> > 01:34:55.093306847 +0200
> > --- src/testdir/test_popup.vim  2017-10-31 22:15:48.865608389 +0100
> > ***
> > *** 639,645 
> > endif
> > let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set 
> > noswapfile'], {'term_rows': h / 3})
> > call term_sendkeys(g:buf, (h / 3 - 1)."o\")
> > !   call term_wait(g:buf, 200)
> > call term_sendkeys(g:buf, "Gi\")
> > call term_sendkeys(g:buf, "\")
> > call term_wait(g:buf, 100)
> > --- 639,645 
> > endif
> > let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set 
> > noswapfile'], {'term_rows': h / 3})
> > call term_sendkeys(g:buf, (h / 3 - 1)."o\")
> > !   call term_wait(g:buf, 500)
> 
> Wouldn't something more deterministic be better?  How about this?
> 
> diff --git i/src/testdir/test_popup.vim w/src/testdir/test_popup.vim
> index 2781aabcd..a4bed18d9 100644
> --- i/src/testdir/test_popup.vim
> +++ w/src/testdir/test_popup.vim
> @@ -639,7 +639,8 @@ func Test_popup_and_window_resize()
>endif
>let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], 
> {'term_rows': h / 3})
>call term_sendkeys(g:buf, (h / 3 - 1)."o\")
> -  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,1\>"', h, h / 3))
>call term_sendkeys(g:buf, "Gi\")
>call term_sendkeys(g:buf, "\")
>call term_wait(g:buf, 100)

That's defenitely better than an arbitrary delay.  However, I think your
check just never matches and causes a delay of one second.

-- 
Sorry, no fortune today.

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


Re: Patch 8.0.1241

2017-10-31 Fir de Conversatie James McCoy
On Tue, Oct 31, 2017 at 10:20:14PM +0100, Bram Moolenaar wrote:
> *** ../vim-8.0.1240/src/testdir/test_popup.vim2017-10-27 
> 01:34:55.093306847 +0200
> --- src/testdir/test_popup.vim2017-10-31 22:15:48.865608389 +0100
> ***
> *** 639,645 
> endif
> let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], 
> {'term_rows': h / 3})
> call term_sendkeys(g:buf, (h / 3 - 1)."o\")
> !   call term_wait(g:buf, 200)
> call term_sendkeys(g:buf, "Gi\")
> call term_sendkeys(g:buf, "\")
> call term_wait(g:buf, 100)
> --- 639,645 
> endif
> let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], 
> {'term_rows': h / 3})
> call term_sendkeys(g:buf, (h / 3 - 1)."o\")
> !   call term_wait(g:buf, 500)

Wouldn't something more deterministic be better?  How about this?

diff --git i/src/testdir/test_popup.vim w/src/testdir/test_popup.vim
index 2781aabcd..a4bed18d9 100644
--- i/src/testdir/test_popup.vim
+++ w/src/testdir/test_popup.vim
@@ -639,7 +639,8 @@ func Test_popup_and_window_resize()
   endif
   let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], 
{'term_rows': h / 3})
   call term_sendkeys(g:buf, (h / 3 - 1)."o\")
-  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,1\>"', h, h / 3))
   call term_sendkeys(g:buf, "Gi\")
   call term_sendkeys(g:buf, "\")
   call term_wait(g:buf, 100)

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB

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


Patch 8.0.1241

2017-10-31 Fir de Conversatie Bram Moolenaar

Patch 8.0.1241
Problem:Popup test is flaky. (James McCoy)
Solution:   Increase the wait time. (Dominique Pelle)
Files:  src/testdir/test_popup.vim


*** ../vim-8.0.1240/src/testdir/test_popup.vim  2017-10-27 01:34:55.093306847 
+0200
--- src/testdir/test_popup.vim  2017-10-31 22:15:48.865608389 +0100
***
*** 639,645 
endif
let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], 
{'term_rows': h / 3})
call term_sendkeys(g:buf, (h / 3 - 1)."o\")
!   call term_wait(g:buf, 200)
call term_sendkeys(g:buf, "Gi\")
call term_sendkeys(g:buf, "\")
call term_wait(g:buf, 100)
--- 639,645 
endif
let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], 
{'term_rows': h / 3})
call term_sendkeys(g:buf, (h / 3 - 1)."o\")
!   call term_wait(g:buf, 500)
call term_sendkeys(g:buf, "Gi\")
call term_sendkeys(g:buf, "\")
call term_wait(g:buf, 100)
*** ../vim-8.0.1240/src/version.c   2017-10-30 21:56:18.623439255 +0100
--- src/version.c   2017-10-31 22:16:31.005347354 +0100
***
*** 763,764 
--- 763,766 
  {   /* Add new patch number below this line */
+ /**/
+ 1241,
  /**/

-- 
"When I die, I want a tombstone that says "GAME OVER" - Ton Richters

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