Test_popup_and_window_resize() failures

2017-10-30 Fir de Conversatie James McCoy
I recently uploaded 8.0.1226 to Debian and nearly every build failed[0].
The most common failure is

Found errors in Test_popup_and_window_resize():
function RunTheTest[34]..Test_popup_and_window_resize line 16: Pattern 
'^!\\s*$' does not match ''
function RunTheTest[34]..Test_popup_and_window_resize line 26: Pattern 
'^!\\s*$' does not match '~ 
  '
function RunTheTest[34]..Test_popup_and_window_resize line 28: Pattern 
'^!\\s*$' does not match ''

I investigated some and that test appears to be extremely flaky in those
environments.  I haven't had a failure yet locally (amd64 system), but
those architectures fail almost every run.

Attached is a log from that test and the associated diff showing where I
added ch_log() calls.

[0]: 
https://buildd.debian.org/status/logs.php?pkg=vim&ver=2%3A8.0.1226-1&suite=sid

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.
 start log session 
  0.001498 : Starting job: ../vim  --clean  -c  set noswapfile
  0.002572 on 1: Created channel
  0.002628 on 1: using pty /dev/pts/3 on fd 5
  0.005027 on 1: writing out to buffer '!../vim'
  0.005159 on 1: writing err to buffer '!../vim'
  0.005244 : ioctl(TIOCSWINSZ) success
  0.005822 : Creating 14 empty lines
  0.006040 SEND on 1: '1'
  0.006109 SEND on 1: '4'
  0.006134 SEND on 1: 'o'
  0.006171 SEND on 1: ''
  0.006262 : Waiting...
  0.006435 RECV on 1: '14o^['
  0.006465 : looking for messages on channels
  0.006517 on 1: writing 5 bytes to terminal
  0.00 on 1: updating screen
  0.206918 : looking for messages on channels
  0.207105 : Starting completion
  0.207228 SEND on 1: 'G'
  0.207277 SEND on 1: 'i'
  0.207299 SEND on 1: ''
  0.207387 SEND on 1: ''
  0.207468 : Waiting...
  0.207575 RECV on 1: 'Gi^X^'
  0.207586 : looking for messages on channels
  0.207614 on 1: writing 6 bytes to terminal
  0.207671 on 1: updating screen
  0.307861 : looking for messages on channels
  0.308039 : ... for the ! entry
  0.319199 : looking for messages on channels
  0.384362 RECV on 1: 
'[?1000h[?2004h[?1049h[?1h=[?2004h[?12h[?12l�
  [>c]10;?]11;?'
  0.384394 on 1: writing 126 bytes to terminal
  0.385175 on 1: updating screen
  0.395798 RECV on 1: '[?25l~   
   ~  

~ 
 ~
  ~   

   ~  
~ 
 ~
  
~
  ~  
~
  
~
  ~  

0,0-1All[?25h[?25l-- INSERT 
--2,1All15,0-1Bot[?25h[?25l
-- INSERT --15,1Bot^X mode 
(^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)[?25h'
  0.395824 : looking for messages on channels
  0.395887 on 1: writing 1781 bytes to terminal
  0.398595 on 1: updating screen
  0.409164 : looking for messages on channels
  1.365880 : Resizing window to 45 lines
  1.366077 : Waiting...
  1.366165 : looking for messages on channels
  1.466420 : Redraw
  1.467517 on 1: Resizing terminal to 44 lines
  1

Re: [vim/vim] `:unlet $FOOBAR` (#1116)

2017-10-30 Fir de Conversatie Luc Hermitte
Hi,

> OTOH, on Linux, after assigning the empty string, exists('$FOOBAR')
> still returns 1, while ":unlet $FOOBAR" gives error E488: Trailing
> characters.
> 
> The classical way to test for "empty or undefined" is
> 
> if ("X" . $FOOBAR) == "X"
> 
> which, AFAICT, returns true even if $FOOBAR is undefined (i.e. has
> never been set in this environment).

We can also test for "is set" with 

[[ -n ${FOOBAR+x} ]] && echo 1

or more simply with bash 4.2+

[[ -v FOOBAR ]] && echo 1

Anyway, the distinction becomes interesting as a few programs interpret the 
unset state as "use a default value", while an empty string really means an 
empty string.

Given foo.c, and a properly configured gnumake (i.e. not MinGW make), the 
following will yield different results

$> CC=clang make foo
# prints: clangfoo.c   -o foo

$> CC= make foo
# prints: foo.c   -o foo
# and can't compile anything

$> unset CC # just to assert the situation
$> make foo
# prints: ccfoo.c   -o foo

This is the recurrent use case I run into that's behind the issue I've opened a 
while back.

Regards,

-- 
Luc Hermitte

-- 
-- 
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: [vim/vim] `:unlet $FOOBAR` (#1116)

2017-10-30 Fir de Conversatie Tony Mechelynck
On Mon, Oct 30, 2017 at 7:31 PM, 'Andy Wokula' via vim_dev
 wrote:
> Am 26.09.2016 um 00:10 schrieb Luc Hermitte (Vim Github Repository):
>>
>> When an environment variable isn't set, `exists()` return false. We can
>> assign a value to the variable with `:let`, after which point it exists. But
>> we can't revert to an non-existent state (related to `unsetenv (3C)`)
>>
>> ```vim
>> call assert_false(exists('$FOOBAR'))
>> let $FOOBAR = 1
>> call assert_true(exists('$FOOBAR'))
>> unlet $FOOBAR
>> call assert_false(exists('$FOOBAR'))
>> ```
>
>
> At least on Windows, assigning the empty string "unlets" it.
>
> --
> Andy

OTOH, on Linux, after assigning the empty string, exists('$FOOBAR')
still returns 1, while ":unlet $FOOBAR" gives error E488: Trailing
characters.

The classical way to test for "empty or undefined" is

if ("X" . $FOOBAR) == "X"

which, AFAICT, returns true even if $FOOBAR is undefined (i.e. has
never been set in this environment).

Best regards,
Tony.

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

2017-10-30 Fir de Conversatie Bram Moolenaar

Patch 8.0.1240
Problem:MS-Windows: term_start() does not support environment.
Solution:   Implement the environment argument. (Yasuhiro Matsumoto, closes
#2264)
Files:  src/os_win32.c, src/proto/os_win32.pro, src/terminal.c,
src/testdir/test_terminal.vim


*** ../vim-8.0.1239/src/os_win32.c  2017-08-17 11:22:41.836109216 +0200
--- src/os_win32.c  2017-10-30 21:53:21.820698340 +0100
***
*** 5033,5040 
   * Turn the dictionary "env" into a NUL separated list that can be used as the
   * environment argument of vim_create_process().
   */
! static void
! make_job_env(garray_T *gap, dict_T *env)
  {
  hashitem_T*hi;
  int   todo = (int)env->dv_hashtab.ht_used;
--- 5033,5040 
   * Turn the dictionary "env" into a NUL separated list that can be used as the
   * environment argument of vim_create_process().
   */
! void
! win32_build_env(dict_T *env, garray_T *gap)
  {
  hashitem_T*hi;
  int   todo = (int)env->dv_hashtab.ht_used;
***
*** 5133,5139 
  }
  
  if (options->jo_env != NULL)
!   make_job_env(&ga, options->jo_env);
  
  ZeroMemory(&pi, sizeof(pi));
  ZeroMemory(&si, sizeof(si));
--- 5133,5139 
  }
  
  if (options->jo_env != NULL)
!   win32_build_env(options->jo_env, &ga);
  
  ZeroMemory(&pi, sizeof(pi));
  ZeroMemory(&si, sizeof(si));
*** ../vim-8.0.1239/src/proto/os_win32.pro  2017-08-11 16:31:50.329234432 
+0200
--- src/proto/os_win32.pro  2017-10-30 21:53:21.820698340 +0100
***
*** 67,70 
--- 67,71 
  void set_alist_count(void);
  void fix_arg_enc(void);
  int mch_setenv(char *var, char *value, int x);
+ void win32_build_env(dict_T *l, garray_T *gap);
  /* vim: set ft=c : */
*** ../vim-8.0.1239/src/terminal.c  2017-10-15 22:56:45.763420554 +0200
--- src/terminal.c  2017-10-30 21:53:21.824698311 +0100
***
*** 46,54 
--- 46,63 
   * - Redirecting output does not work on MS-Windows, 
Test_terminal_redir_file()
   *   is disabled.
   * - cursor blinks in terminal on widows with a timer. (xtal8, #2142)
+  * - When closing gvim with an active terminal buffer, the dialog suggests
+  *   saving the buffer.  Should say something else. (Manas Thakur, #2215)
+  *   Also: #2223
   * - implement term_setsize()
+  * - Termdebug does not work when Vim build with mzscheme.  gdb hangs.
+  * - Termdebug: issue #2154 might be avoided by adding -quiet to gdb?
+  *   patch by Christian, 2017 Oct 23.
   * - MS-Windows GUI: WinBar has  tearoff item
   * - MS-Windows GUI: still need to type a key after shell exits?  #1924
+  * - What to store in a session file?  Shell at the prompt would be OK to
+  *   restore, but others may not.  Open the window and let the user start the
+  *   command?
   * - add test for giving error for invalid 'termsize' value.
   * - support minimal size when 'termsize' is "rows*cols".
   * - support minimal size when 'termsize' is empty?
***
*** 3390,3395 
--- 3399,3405 
  {
  WCHAR *cmd_wchar = NULL;
  WCHAR *cwd_wchar = NULL;
+ WCHAR *env_wchar = NULL;
  channel_T *channel = NULL;
  job_T *job = NULL;
  DWORD error;
***
*** 3398,3404 
  HANDLEchild_thread_handle;
  void  *winpty_err;
  void  *spawn_config = NULL;
! garray_T  ga;
  char_u*cmd;
  
  if (dyn_winpty_init(TRUE) == FAIL)
--- 3408,3414 
  HANDLEchild_thread_handle;
  void  *winpty_err;
  void  *spawn_config = NULL;
! garray_T  ga_cmd, ga_env;
  char_u*cmd;
  
  if (dyn_winpty_init(TRUE) == FAIL)
***
*** 3408,3417 
cmd = argvar->vval.v_string;
  else
  {
!   ga_init2(&ga, (int)sizeof(char*), 20);
!   if (win32_build_cmd(argvar->vval.v_list, &ga) == FAIL)
goto failed;
!   cmd = ga.ga_data;
  }
  
  cmd_wchar = enc_to_utf16(cmd, NULL);
--- 3418,3427 
cmd = argvar->vval.v_string;
  else
  {
!   ga_init2(&ga_cmd, (int)sizeof(char*), 20);
!   if (win32_build_cmd(argvar->vval.v_list, &ga_cmd) == FAIL)
goto failed;
!   cmd = ga_cmd.ga_data;
  }
  
  cmd_wchar = enc_to_utf16(cmd, NULL);
***
*** 3419,3424 
--- 3429,3440 
return FAIL;
  if (opt->jo_cwd != NULL)
cwd_wchar = enc_to_utf16(opt->jo_cwd, NULL);
+ if (opt->jo_env != NULL)
+ {
+   ga_init2(&ga_env, (int)sizeof(char*), 20);
+   win32_build_env(opt->jo_env, &ga_env);
+   env_wchar = ga_env.ga_data;
+ }
  
  job = job_alloc();
  if (job == NULL)
***
*** 3446,3452 
NULL,
cmd_wchar,
cwd_wchar,
!   NULL,
&winpty_err);
  if (spawn_config == NULL)
goto failed;
--- 34

Patch 8.0.1239

2017-10-30 Fir de Conversatie Bram Moolenaar

Patch 8.0.1239
Problem:Cannot use a lambda for the skip argument to searchpair().
Solution:   Evaluate a partial, funcref and lambda. (LemonBoy, closes #1454,
closes #2265)
Files:  runtime/doc/eval.txt, src/evalfunc.c, src/proto/evalfunc.pro,
src/eval.c, src/proto/eval.pro, src/search.c,
src/testdir/test_search.vim


*** ../vim-8.0.1238/runtime/doc/eval.txt2017-10-28 21:08:38.967457092 
+0200
--- runtime/doc/eval.txt2017-10-30 20:33:56.554407802 +0100
***
*** 6781,6786 
--- 6793,6799 
When {skip} is omitted or empty, every match is accepted.
When evaluating {skip} causes an error the search is aborted
and -1 returned.
+   {skip} can be a string, a lambda, a funcref or a partial.
  
For {stopline} and {timeout} see |search()|.
  
*** ../vim-8.0.1238/src/evalfunc.c  2017-10-28 21:08:38.979457009 +0200
--- src/evalfunc.c  2017-10-30 21:21:15.250475760 +0100
***
*** 9531,9543 
  searchpair_cmn(typval_T *argvars, pos_T *match_pos)
  {
  char_u*spat, *mpat, *epat;
! char_u*skip;
  int   save_p_ws = p_ws;
  int   dir;
  int   flags = 0;
  char_unbuf1[NUMBUFLEN];
  char_unbuf2[NUMBUFLEN];
- char_unbuf3[NUMBUFLEN];
  int   retval = 0; /* default: FAIL */
  long  lnum_stop = 0;
  long  time_limit = 0;
--- 9531,9542 
  searchpair_cmn(typval_T *argvars, pos_T *match_pos)
  {
  char_u*spat, *mpat, *epat;
! typval_T  *skip;
  int   save_p_ws = p_ws;
  int   dir;
  int   flags = 0;
  char_unbuf1[NUMBUFLEN];
  char_unbuf2[NUMBUFLEN];
  int   retval = 0; /* default: FAIL */
  long  lnum_stop = 0;
  long  time_limit = 0;
***
*** 9571,9580 
  /* Optional fifth argument: skip expression */
  if (argvars[3].v_type == VAR_UNKNOWN
|| argvars[4].v_type == VAR_UNKNOWN)
!   skip = (char_u *)"";
  else
  {
!   skip = get_tv_string_buf_chk(&argvars[4], nbuf3);
if (argvars[5].v_type != VAR_UNKNOWN)
{
lnum_stop = (long)get_tv_number_chk(&argvars[5], NULL);
--- 9570,9585 
  /* Optional fifth argument: skip expression */
  if (argvars[3].v_type == VAR_UNKNOWN
|| argvars[4].v_type == VAR_UNKNOWN)
!   skip = NULL;
  else
  {
!   skip = &argvars[4];
!   if (skip->v_type != VAR_FUNC && skip->v_type != VAR_PARTIAL
!   && skip->v_type != VAR_STRING)
!   {
!   /* Type error */
!   goto theend;
!   }
if (argvars[5].v_type != VAR_UNKNOWN)
{
lnum_stop = (long)get_tv_number_chk(&argvars[5], NULL);
***
*** 9590,9597 
  #endif
}
  }
- if (skip == NULL)
-   goto theend;/* type error */
  
  retval = do_searchpair(spat, mpat, epat, dir, skip, flags,
match_pos, lnum_stop, time_limit);
--- 9595,9600 
***
*** 9645,9651 
  char_u*mpat,  /* middle pattern */
  char_u*epat,  /* end pattern */
  int   dir,/* BACKWARD or FORWARD */
! char_u*skip,  /* skip expression */
  int   flags,  /* SP_SETPCMARK and other SP_ values */
  pos_T *match_pos,
  linenr_T  lnum_stop,  /* stop at this line if not zero */
--- 9648,9654 
  char_u*mpat,  /* middle pattern */
  char_u*epat,  /* end pattern */
  int   dir,/* BACKWARD or FORWARD */
! typval_T  *skip,  /* skip expression */
  int   flags,  /* SP_SETPCMARK and other SP_ values */
  pos_T *match_pos,
  linenr_T  lnum_stop,  /* stop at this line if not zero */
***
*** 9662,9667 
--- 9665,9671 
  int   n;
  int   r;
  int   nest = 1;
+ int   use_skip = FALSE;
  int   err;
  int   options = SEARCH_KEEP;
  proftime_Ttm;
***
*** 9690,9695 
--- 9694,9707 
  if (flags & SP_START)
options |= SEARCH_START;
  
+ if (skip != NULL)
+ {
+   /* Empty string means to not use the skip expression. */
+   if (skip->v_type == VAR_STRING || skip->v_type == VAR_FUNC)
+   use_skip = skip->vval.v_string != NULL
+   && *skip->vval.v_string != NUL;
+ }
+ 
  save_cursor = curwin->w_cursor;
  pos = curwin->w_cursor;
  CLEAR_POS(&firstpos);
***
*** 9721,9731 
options &= ~SEARCH_START;
  
/* If the skip pattern matches, ignore this match. */
!   if (*skip != NUL)
{
  

Re: [vim/vim] `:unlet $FOOBAR` (#1116)

2017-10-30 Fir de Conversatie 'Andy Wokula' via vim_dev

Am 26.09.2016 um 00:10 schrieb Luc Hermitte (Vim Github Repository):

When an environment variable isn't set, `exists()` return false. We can assign 
a value to the variable with `:let`, after which point it exists. But we can't 
revert to an non-existent state (related to `unsetenv (3C)`)

```vim
call assert_false(exists('$FOOBAR'))
let $FOOBAR = 1
call assert_true(exists('$FOOBAR'))
unlet $FOOBAR
call assert_false(exists('$FOOBAR'))
```


At least on Windows, assigning the empty string "unlets" it.

--
Andy

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

2017-10-30 Fir de Conversatie haya14busa
On Monday, October 30, 2017 at 12:40:55 AM UTC+9, Bram Moolenaar wrote:
> Patch 8.0.1238
> Problem:Incremental search only shows one match.
> Solution:   When 'incsearch' and and 'hlsearch' are both set highlight all
> matches. (haya14busa, closes #2198)
> Files:  runtime/doc/options.txt, src/ex_getln.c, src/proto/search.pro,
> src/search.c, src/testdir/test_search.vim
> 
> 
> *** ../vim-8.0.1237/runtime/doc/options.txt   2017-10-08 17:41:30.084460598 
> +0200
> --- runtime/doc/options.txt   2017-10-29 16:26:46.071744991 +0100
>   /**1
> ***
> *** 4034,4064 
>   define one.  The default uses a different group for each occasion.
>   See |highlight-default| for the default highlight groups.
>   
> -  *'hlsearch'* *'hls'* *'nohlsearch'* *'nohls'*
> - 'hlsearch' 'hls'boolean (default off)
> - global
> - {not in Vi}
> - {not available when compiled without the
> - |+extra_search| feature}
> - When there is a previous search pattern, highlight all its matches.
> - The type of highlighting used can be set with the 'l' occasion in the
> - 'highlight' option.  This uses the "Search" highlight group by
> - default.  Note that only the matching text is highlighted, any offsets
> - are not applied.
> - See also: 'incsearch' and |:match|.
> - When you get bored looking at the highlighted matches, you can turn it
> - off with |:nohlsearch|.  This does not change the option value, as
> - soon as you use a search command, the highlighting comes back.
> - 'redrawtime' specifies the maximum time spent on finding matches.
> - When the search pattern can match an end-of-line, Vim will try to
> - highlight all of the matched text.  However, this depends on where the
> - search starts.  This will be the first line in the window or the first
> - line below a closed fold.  A match in a previous line which is not
> - drawn may not continue in a newly drawn line.
> - You can specify whether the highlight status is restored on startup
> - with the 'h' flag in 'viminfo' |viminfo-h|.
> - NOTE: This option is reset when 'compatible' is set.
> - 
>   *'history'* *'hi'*
>   'history' 'hi'  number  (Vim default: 50, Vi default: 0,
>set to 200 in |defaults.vim|)
> --- 4130,4135 
> ***
> *** 4093,4098 
> --- 4164,4194 
>   See |rileft.txt|.
>   NOTE: This option is reset when 'compatible' is set.
>   
> +  *'hlsearch'* *'hls'* *'nohlsearch'* *'nohls'*
> + 'hlsearch' 'hls'boolean (default off)
> + global
> + {not in Vi}
> + {not available when compiled without the
> + |+extra_search| feature}
> + When there is a previous search pattern, highlight all its matches.
> + The type of highlighting used can be set with the 'l' occasion in the
> + 'highlight' option.  This uses the "Search" highlight group by
> + default.  Note that only the matching text is highlighted, any offsets
> + are not applied.
> + See also: 'incsearch' and |:match|.
> + When you get bored looking at the highlighted matches, you can turn it
> + off with |:nohlsearch|.  This does not change the option value, as
> + soon as you use a search command, the highlighting comes back.
> + 'redrawtime' specifies the maximum time spent on finding matches.
> + When the search pattern can match an end-of-line, Vim will try to
> + highlight all of the matched text.  However, this depends on where the
> + search starts.  This will be the first line in the window or the first
> + line below a closed fold.  A match in a previous line which is not
> + drawn may not continue in a newly drawn line.
> + You can specify whether the highlight status is restored on startup
> + with the 'h' flag in 'viminfo' |viminfo-h|.
> + NOTE: This option is reset when 'compatible' is set.
> + 
>   *'icon'* *'noicon'*
>   'icon'  boolean (default off, on when title can be 
> restored)
>   global
> ***
> *** 4344,4357 
>   original position when no match is found and when pressing .  You
>   still need to finish the search command with  to move the
>   cursor to the match.
> ! You can use the CTRL-N and CTRL-P keys to move to the next and
> ! previous match. |c_CTRL-N| |c_CTRL-P|
>   When compiled with the |+reltime| feature Vim only searches for about
>   half a second.  With a complicated pattern and/or a lot of text the
>   match may not be found.  This is to avoid that Vim hangs while you
>   are typing the pattern.
>   T