Re: Patch 8.2.2945

2021-06-05 Fir de Conversatie Yegappan Lakshmanan
Hi Bram,

On Sat, Jun 5, 2021 at 12:52 PM Bram Moolenaar  wrote:
>
>
> I wrote:
>
> > Patch 8.2.2945
> > Problem:Some buffer related code is not tested.
> > Solution:   Add a few more tests. (Yegappan Lakshmanan, closes #8320)
> > Files:  src/termlib.c, src/testdir/test_excmd.vim,
> > src/testdir/test_recover.vim, src/testdir/test_swap.vim,
> > src/testdir/test_visual.vim
>
> It appears that after this change Test_recover_corrupted_swap_file()
> fails on Travis.  The swap file should have been corrupted properly, but
> perhaps after using writefile() we need to wait or sync?
> Or did the writefile() fail?
>

I don't see this failure in Travis. Can you send a link to the test
results page?

Thanks,
Yegappan

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAAW7x7nB-V%3D4uc32k5o45yGScpwsOYg9xp6OGQc%3Dj24yAhqmdA%40mail.gmail.com.


Re: Patch 8.2.2944

2021-06-05 Fir de Conversatie John Marriott



On 06-Jun-2021 04:52, Bram Moolenaar wrote:

Patch 8.2.2944
Problem:Vim9: no error when using job or channel as a string.
Solution:   Be more strict about conversion to string. (closes #8312)
Files:  src/typval.c, src/job.c, src/proto/job.pro, src/channel.c,
 src/proto/channel.pro, src/eval.c, src/vim9execute.c,
 src/testdir/test_vim9_builtin.vim


After this patch, mingw64 (gcc 11.1.0) throws this warning and then this 
linker error if FEAT_JOB_CHANNEL is disabled:


gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD eval.c -o gobjnative/eval.o

eval.c: In function 'echo_string_core':
eval.c:5063:41: warning: implicit declaration of function 
'job_to_string_buf' [-Wimplicit-function-declaration]
 5063 | r = tv->v_type == VAR_JOB ? job_to_string_buf(tv, 
numbuf)

  | ^
eval.c:5064:46: warning: implicit declaration of function 
'channel_to_string_buf' [-Wimplicit-function-declaration]
 5064 |    : 
channel_to_string_buf(tv, numbuf);

  | ^
eval.c:5063:15: warning: assignment to 'char_u *' {aka 'unsigned char 
*'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
 5063 | r = tv->v_type == VAR_JOB ? job_to_string_buf(tv, 
numbuf)

  |   ^
...
gcc -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD -Wl,-nxcompat,-dynamicbase 
-municode -s -mwindows -o gvim.exe gobjnative/arabic.o 
gobjnative/arglist.o gobjnative/autocmd.o gobjnative/beval.o 
gobjnative/blob.o gobjnative/blowfish.o gobjnative/buffer.o 
gobjnative/bufwrite.o gobjnative/change.o gobjnative/charset.o 
gobjnative/cindent.o gobjnative/clientserver.o gobjnative/clipboard.o 
gobjnative/cmdexpand.o gobjnative/cmdhist.o gobjnative/crypt.o 
gobjnative/crypt_zip.o gobjnative/debugger.o gobjnative/dict.o 
gobjnative/diff.o gobjnative/digraph.o gobjnative/drawline.o 
gobjnative/drawscreen.o gobjnative/edit.o gobjnative/eval.o 
gobjnative/evalbuffer.o gobjnative/evalfunc.o gobjnative/evalvars.o 
gobjnative/evalwindow.o gobjnative/ex_cmds.o gobjnative/ex_cmds2.o 
gobjnative/ex_docmd.o gobjnative/ex_eval.o gobjnative/ex_getln.o 
gobjnative/fileio.o gobjnative/filepath.o gobjnative/findfile.o 
gobjnative/float.o gobjnative/fold.o gobjnative/getchar.o 
gobjnative/gui_xim.o gobjnative/hardcopy.o gobjnative/hashtab.o 
gobjnative/help.o gobjnative/highlight.o gobjnative/if_cscope.o 
gobjnative/indent.o gobjnative/insexpand.o gobjnative/json.o 
gobjnative/list.o gobjnative/locale.o gobjnative/main.o gobjnative/map.o 
gobjnative/mark.o gobjnative/match.o gobjnative/memfile.o 
gobjnative/memline.o gobjnative/menu.o gobjnative/message.o 
gobjnative/misc1.o gobjnative/misc2.o gobjnative/mouse.o 
gobjnative/move.o gobjnative/mbyte.o gobjnative/normal.o 
gobjnative/ops.o gobjnative/option.o gobjnative/optionstr.o 
gobjnative/os_mswin.o gobjnative/os_win32.o gobjnative/pathdef.o 
gobjnative/popupmenu.o gobjnative/popupwin.o gobjnative/profiler.o 
gobjnative/quickfix.o gobjnative/regexp.o gobjnative/register.o 
gobjnative/scriptfile.o gobjnative/screen.o gobjnative/search.o 
gobjnative/session.o gobjnative/sha256.o gobjnative/sign.o 
gobjnative/spell.o gobjnative/spellfile.o gobjnative/spellsuggest.o 
gobjnative/syntax.o gobjnative/tag.o gobjnative/term.o 
gobjnative/testing.o gobjnative/textformat.o gobjnative/textobject.o 
gobjnative/textprop.o gobjnative/time.o gobjnative/typval.o 
gobjnative/ui.o gobjnative/undo.o gobjnative/usercmd.o 
gobjnative/userfunc.o gobjnative/version.o gobjnative/vim9compile.o 
gobjnative/vim9execute.o gobjnative/vim9script.o gobjnative/vim9type.o 
gobjnative/viminfo.o gobjnative/winclip.o gobjnative/window.o 
gobjnative/os_w32exe.o gobjnative/vimres.o gobjnative/xdiffi.o 
gobjnative/xemit.o gobjnative/xprepare.o gobjnative/xutils.o 
gobjnative/xhistogram.o gobjnative/xpatience.o gobjnative/gui.o 
gobjnative/gui_w32.o gobjnative/gui_beval.o -lkernel32 -luser32 -lgdi32 
-ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion -lole32 -luuid
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/eval.o:eval.c:(.text+0x3f19): undefined reference to 
`channel_to_string_buf'
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
gobjnative/eval.o:eval.c:(.text+0x41c1): undefined reference to 
`job_to_string_buf'

collect2.exe: error: ld returned 1 exit status
make: *** 

Re: Patch 8.2.2945

2021-06-05 Fir de Conversatie Bram Moolenaar


I wrote:

> Patch 8.2.2945
> Problem:Some buffer related code is not tested.
> Solution:   Add a few more tests. (Yegappan Lakshmanan, closes #8320)
> Files:  src/termlib.c, src/testdir/test_excmd.vim,
> src/testdir/test_recover.vim, src/testdir/test_swap.vim,
> src/testdir/test_visual.vim

It appears that after this change Test_recover_corrupted_swap_file()
fails on Travis.  The swap file should have been corrupted properly, but
perhaps after using writefile() we need to wait or sync?
Or did the writefile() fail?

-- 
NEIL INNES PLAYED: THE FIRST SELF-DESTRUCTIVE MONK, ROBIN'S LEAST FAVORITE
   MINSTREL, THE PAGE CRUSHED BY A RABBIT, THE OWNER OF A DUCK
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202106051952.155JqDBw126529%40masaka.moolenaar.net.


Patch 8.2.2946

2021-06-05 Fir de Conversatie Bram Moolenaar


Patch 8.2.2946
Problem:Vim9: substitute expression cannot be a List in a :def function.
Solution:   Use typval2string(). (closes #8330)
Files:  src/vim9execute.c, src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.2945/src/vim9execute.c   2021-06-05 20:51:34.737122348 +0200
--- src/vim9execute.c   2021-06-05 21:30:18.346986522 +0200
***
*** 4130,4136 
  {
typval_T *tv = STACK_TV_BOT(-1);
  
!   res = vim_strsave(tv_get_string(tv));
--ectx->ec_stack.ga_len;
clear_tv(tv);
  }
--- 4130,4136 
  {
typval_T *tv = STACK_TV_BOT(-1);
  
!   res = typval2string(tv, TRUE);
--ectx->ec_stack.ga_len;
clear_tv(tv);
  }
*** ../vim-8.2.2945/src/testdir/test_vim9_cmd.vim   2021-06-05 
17:10:46.538051161 +0200
--- src/testdir/test_vim9_cmd.vim   2021-06-05 21:35:15.202183043 +0200
***
*** 1236,1241 
--- 1236,1248 
END
CheckScriptSuccess(lines)
unlet g:cond
+ 
+   # List results in multiple lines
+   new
+   setline(1, 'some text here')
+   s/text/\=['aaa', 'bbb', 'ccc']/ 
+   assert_equal(['some aaa', 'bbb', 'ccc', ' here'], getline(1, '$'))
+   bwipe!
  enddef
  
  def Test_redir_to_var()
*** ../vim-8.2.2945/src/version.c   2021-06-05 20:59:18.623771739 +0200
--- src/version.c   2021-06-05 21:31:25.022806806 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 2946,
  /**/

-- 
ERIC IDLE PLAYED: THE DEAD COLLECTOR, MR BINT (A VILLAGE NE'ER-DO -WELL VERY
  KEEN ON BURNING WITCHES), SIR ROBIN, THE GUARD WHO DOESN'T
  HICOUGH BUT TRIES TO GET THINGS STRAIGHT, CONCORDE (SIR
  LAUNCELOT'S TRUSTY STEED), ROGER THE SHRUBBER (A SHRUBBER),
  BROTHER MAYNARD
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202106051939.155JdRrH123966%40masaka.moolenaar.net.


Patch 8.2.2945

2021-06-05 Fir de Conversatie Bram Moolenaar


Patch 8.2.2945
Problem:Some buffer related code is not tested.
Solution:   Add a few more tests. (Yegappan Lakshmanan, closes #8320)
Files:  src/termlib.c, src/testdir/test_excmd.vim,
src/testdir/test_recover.vim, src/testdir/test_swap.vim,
src/testdir/test_visual.vim


*** ../vim-8.2.2944/src/termlib.c   2019-12-05 21:32:07.0 +0100
--- src/termlib.c   2021-06-05 20:57:28.196091176 +0200
***
*** 591,597 
  static char *
  _find(char *s, char *set)
  {
! for(; *s; s++)
  {
char*ptr = set;
  
--- 591,597 
  static char *
  _find(char *s, char *set)
  {
! for (; *s; s++)
  {
char*ptr = set;
  
*** ../vim-8.2.2944/src/testdir/test_excmd.vim  2021-05-06 17:36:50.984003922 
+0200
--- src/testdir/test_excmd.vim  2021-06-05 20:57:28.196091176 +0200
***
*** 69,74 
--- 69,82 
call assert_fails('3file', 'E474:')
call assert_fails('0,0file', 'E474:')
call assert_fails('0file abc', 'E474:')
+   if !has('win32')
+ " Change the name of the buffer to the same name
+ new Xfile1
+ file Xfile1
+ call assert_equal('Xfile1', @%)
+ call assert_equal('Xfile1', @#)
+ bw!
+   endif
  endfunc
  
  " Test for the :drop command
*** ../vim-8.2.2944/src/testdir/test_recover.vim2021-03-10 
22:27:44.597737046 +0100
--- src/testdir/test_recover.vim2021-06-05 20:57:28.196091176 +0200
***
*** 133,136 
--- 133,263 
call delete(swname)
  endfunc
  
+ " Test for :recover with multiple swap files
+ func Test_recover_multiple_swap_files()
+   CheckUnix
+   new Xfile1
+   call setline(1, ['a', 'b', 'c'])
+   preserve
+   let b = readblob('.Xfile1.swp')
+   call writefile(b, '.Xfile1.swm')
+   call writefile(b, '.Xfile1.swn')
+   call writefile(b, '.Xfile1.swo')
+   %bw!
+   call feedkeys(":recover Xfile1\3\q", 'xt')
+   call assert_equal(['a', 'b', 'c'], getline(1, '$'))
+ 
+   call delete('.Xfile1.swm')
+   call delete('.Xfile1.swn')
+   call delete('.Xfile1.swo')
+ endfunc
+ 
+ " Test for :recover using an empty swap file
+ func Test_recover_empty_swap_file()
+   CheckUnix
+   call writefile([], '.Xfile1.swp')
+   let msg = execute('recover Xfile1')
+   call assert_match('Unable to read block 0 from .Xfile1.swp', msg)
+   call assert_equal('Xfile1', @%)
+   bw!
+   " :recover from an empty buffer
+   call assert_fails('recover', 'E305:')
+   call delete('.Xfile1.swp')
+ endfunc
+ 
+ " Test for :recover using a corrupted swap file
+ func Test_recover_corrupted_swap_file()
+   CheckUnix
+   " recover using a partial swap file
+   call writefile(0z1234, '.Xfile1.swp')
+   call assert_fails('recover Xfile1', 'E295:')
+   bw!
+ 
+   " recover using invalid content in the swap file
+   call writefile([repeat('1', 2*1024)], '.Xfile1.swp')
+   call assert_fails('recover Xfile1', 'E307:')
+   call delete('.Xfile1.swp')
+ 
+   " :recover using a swap file with a corrupted header
+   edit Xfile1
+   preserve
+   let sn = swapname('')
+   let b = readblob(sn)
+   bw!
+   " clear the B0_MAGIC_LONG field
+   let b[1008:1011] = 0z
+   call writefile(b, sn)
+   let msg = execute('recover Xfile1')
+   call assert_match('the file has been damaged', msg)
+   bw!
+   call delete(sn)
+ endfunc
+ 
+ " Test for :recover using an encrypted swap file
+ func Test_recover_encrypted_swap_file()
+   CheckUnix
+ 
+   " Recover an encrypted file from the swap file without the original file
+   new Xfile1
+   call feedkeys(":X\vim\vim\", 'xt')
+   call setline(1, ['aaa', 'bbb', 'ccc'])
+   preserve
+   let b = readblob('.Xfile1.swp')
+   call writefile(b, '.Xfile1.swm')
+   bw!
+   call feedkeys(":recover Xfile1\vim\\", 'xt')
+   call assert_equal(['aaa', 'bbb', 'ccc'], getline(1, '$'))
+   bw!
+   call delete('.Xfile1.swm')
+ 
+   " Recover an encrypted file from the swap file with the original file
+   new Xfile1
+   call feedkeys(":X\vim\vim\", 'xt')
+   call setline(1, ['aaa', 'bbb', 'ccc'])
+   update
+   call setline(1, ['111', '222', '333'])
+   preserve
+   let b = readblob('.Xfile1.swp')
+   call writefile(b, '.Xfile1.swm')
+   bw!
+   call feedkeys(":recover Xfile1\vim\\", 'xt')
+   call assert_equal(['111', '222', '333'], getline(1, '$'))
+   call assert_true()
+   bw!
+   call delete('.Xfile1.swm')
+   call delete('Xfile1')
+ endfunc
+ 
+ " Test for :recover using a unreadable swap file
+ func Test_recover_unreadble_swap_file()
+   CheckUnix
+   CheckNotRoot
+   new Xfile1
+   let b = readblob('.Xfile1.swp')
+   call writefile(b, '.Xfile1.swm')
+   bw!
+   call setfperm('.Xfile1.swm', '-w---')
+   call assert_fails('recover Xfile1', 'E306:')
+   call delete('.Xfile1.swm')
+ endfunc
+ 
+ " Test for using :recover when the original file and the swap file have the
+ " same contents.
+ func Test_recover_unmodified_file()
+   CheckUnix
+   call writefile(['aaa', 'bbb', 'ccc'], 'Xfile1')
+   edit Xfile1
+   preserve
+   let b = 

Patch 8.2.2944

2021-06-05 Fir de Conversatie Bram Moolenaar


Patch 8.2.2944
Problem:Vim9: no error when using job or channel as a string.
Solution:   Be more strict about conversion to string. (closes #8312)
Files:  src/typval.c, src/job.c, src/proto/job.pro, src/channel.c,
src/proto/channel.pro, src/eval.c, src/vim9execute.c,
src/testdir/test_vim9_builtin.vim


*** ../vim-8.2.2943/src/typval.c2021-05-09 23:19:17.093003109 +0200
--- src/typval.c2021-06-05 20:42:37.974740560 +0200
***
*** 414,420 
  char_u *
  tv_get_string_buf(typval_T *varp, char_u *buf)
  {
! char_u*res =  tv_get_string_buf_chk(varp, buf);
  
  return res != NULL ? res : (char_u *)"";
  }
--- 414,420 
  char_u *
  tv_get_string_buf(typval_T *varp, char_u *buf)
  {
! char_u*res = tv_get_string_buf_chk(varp, buf);
  
  return res != NULL ? res : (char_u *)"";
  }
***
*** 478,521 
break;
case VAR_JOB:
  #ifdef FEAT_JOB_CHANNEL
{
!   job_T *job = varp->vval.v_job;
!   char  *status;
! 
!   if (job == NULL)
!   return (char_u *)"no process";
!   status = job->jv_status == JOB_FAILED ? "fail"
!   : job->jv_status >= JOB_ENDED ? "dead"
!   : "run";
! # ifdef UNIX
!   vim_snprintf((char *)buf, NUMBUFLEN,
!   "process %ld %s", (long)job->jv_pid, status);
! # elif defined(MSWIN)
!   vim_snprintf((char *)buf, NUMBUFLEN,
!   "process %ld %s",
!   (long)job->jv_proc_info.dwProcessId,
!   status);
! # else
!   // fall-back
!   vim_snprintf((char *)buf, NUMBUFLEN, "process ? %s", status);
! # endif
!   return buf;
}
  #endif
break;
case VAR_CHANNEL:
  #ifdef FEAT_JOB_CHANNEL
{
!   channel_T *channel = varp->vval.v_channel;
!   char  *status = channel_status(channel, -1);
! 
!   if (channel == NULL)
!   vim_snprintf((char *)buf, NUMBUFLEN, "channel %s", status);
!   else
!   vim_snprintf((char *)buf, NUMBUFLEN,
!"channel %d %s", channel->ch_id, status);
!   return buf;
}
  #endif
break;
case VAR_UNKNOWN:
--- 478,499 
break;
case VAR_JOB:
  #ifdef FEAT_JOB_CHANNEL
+   if (in_vim9script())
{
!   semsg(_(e_using_invalid_value_as_string_str), "job");
!   break;
}
+   return job_to_string_buf(varp, buf);
  #endif
break;
case VAR_CHANNEL:
  #ifdef FEAT_JOB_CHANNEL
+   if (in_vim9script())
{
!   semsg(_(e_using_invalid_value_as_string_str), "channel");
!   break;
}
+   return channel_to_string_buf(varp, buf);
  #endif
break;
case VAR_UNKNOWN:
*** ../vim-8.2.2943/src/job.c   2020-12-09 13:16:09.970838581 +0100
--- src/job.c   2021-06-05 20:40:14.811192286 +0200
***
*** 1927,1930 
--- 1927,1960 
rettv->vval.v_number = job_stop(job, argvars, NULL);
  }
  
+ /*
+  * Get a string with information about the job in "varp" in "buf".
+  * "buf" must be at least NUMBUFLEN long.
+  */
+ char_u *
+ job_to_string_buf(typval_T *varp, char_u *buf)
+ {
+ job_T *job = varp->vval.v_job;
+ char  *status;
+ 
+ if (job == NULL)
+   return (char_u *)"no process";
+ status = job->jv_status == JOB_FAILED ? "fail"
+   : job->jv_status >= JOB_ENDED ? "dead"
+   : "run";
+ # ifdef UNIX
+ vim_snprintf((char *)buf, NUMBUFLEN,
+   "process %ld %s", (long)job->jv_pid, status);
+ # elif defined(MSWIN)
+ vim_snprintf((char *)buf, NUMBUFLEN,
+   "process %ld %s",
+   (long)job->jv_proc_info.dwProcessId,
+   status);
+ # else
+ // fall-back
+ vim_snprintf((char *)buf, NUMBUFLEN, "process ? %s", status);
+ # endif
+ return buf;
+ }
+ 
  #endif // FEAT_JOB_CHANNEL
*** ../vim-8.2.2943/src/proto/job.pro   2020-09-05 15:48:32.469546692 +0200
--- src/proto/job.pro   2021-06-05 20:40:29.843144301 +0200
***
*** 34,37 
--- 34,38 
  void f_job_start(typval_T *argvars, typval_T *rettv);
  void f_job_status(typval_T *argvars, typval_T *rettv);
  void f_job_stop(typval_T *argvars, typval_T *rettv);
+ char_u *job_to_string_buf(typval_T *varp, char_u *buf);
  /* vim: set ft=c : */
*** ../vim-8.2.2943/src/channel.c   2021-03-27 21:23:27.064153032 +0100
--- src/channel.c   2021-06-05 20:41:08.351021945 +0200
***
*** 5015,5018 
--- 5015,5036 
  rettv->vval.v_string = vim_strsave((char_u *)channel_status(channel, 
part));
  }
  
+ /*
+  * Get a string with 

Patch 8.2.2943

2021-06-05 Fir de Conversatie Bram Moolenaar


Patch 8.2.2943
Problem:Vim9: check for argument count ignores default values.
Solution:   Take default argument values into account.
Files:  src/vim9execute.c


*** ../vim-8.2.2942/src/vim9execute.c   2021-06-05 18:15:06.614037266 +0200
--- src/vim9execute.c   2021-06-05 18:48:09.805886192 +0200
***
*** 4234,4240 
semsg(_(e_nr_arguments_too_many), idx);
goto failed_early;
  }
! else if (idx < 0)
  {
if (idx == -1)
emsg(_(e_one_argument_too_few));
--- 4234,4241 
semsg(_(e_nr_arguments_too_many), idx);
goto failed_early;
  }
! idx = argc - ufunc->uf_args.ga_len + ufunc->uf_def_args.ga_len;
! if (idx < 0)
  {
if (idx == -1)
emsg(_(e_one_argument_too_few));
*** ../vim-8.2.2942/src/version.c   2021-06-05 18:15:06.614037266 +0200
--- src/version.c   2021-06-05 18:47:37.281956040 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 2943,
  /**/

-- 
INSPECTOR END OF FILM: Move along.  There's nothing to see!  Keep moving!
   [Suddenly he notices the cameras.]
INSPECTOR END OF FILM: (to Camera) All right, put that away sonny.
   [He walks over to it and puts his hand over the lens.]
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202106051650.155Go2O3088329%40masaka.moolenaar.net.


Patch 8.2.2942

2021-06-05 Fir de Conversatie Bram Moolenaar


Patch 8.2.2942
Problem:Vim9: internal error when calling function with too few arguments
Solution:   Check for argument count to be too few. (closes #8325)
Files:  src/errors.h, src/vim9execute.c, src/testdir/test_vim9_builtin.vim


*** ../vim-8.2.2941/src/errors.h2021-06-02 16:47:49.675250216 +0200
--- src/errors.h2021-06-05 17:26:15.775890723 +0200
***
*** 419,421 
--- 419,425 
INIT(= N_("E1188: Cannot open a terminal from the command line 
window"));
  EXTERN char e_cannot_use_legacy_with_command_str[]
INIT(= N_("E1189: Cannot use :legacy with this command: %s"));
+ EXTERN char e_one_argument_too_few[]
+   INIT(= N_("E1190: One argument too few"));
+ EXTERN char e_nr_arguments_too_few[]
+   INIT(= N_("E1190: %d arguments too few"));
*** ../vim-8.2.2941/src/vim9execute.c   2021-06-05 17:10:46.538051161 +0200
--- src/vim9execute.c   2021-06-05 17:31:17.515151487 +0200
***
*** 4234,4239 
--- 4234,4247 
semsg(_(e_nr_arguments_too_many), idx);
goto failed_early;
  }
+ else if (idx < 0)
+ {
+   if (idx == -1)
+   emsg(_(e_one_argument_too_few));
+   else
+   semsg(_(e_nr_arguments_too_few), -idx);
+   goto failed_early;
+ }
  
  // Put arguments on the stack, but no more than what the function expects.
  // A lambda can be called with more arguments than it uses.
*** ../vim-8.2.2941/src/testdir/test_vim9_builtin.vim   2021-05-26 
21:10:07.285101484 +0200
--- src/testdir/test_vim9_builtin.vim   2021-06-05 18:14:24.010128603 +0200
***
*** 810,815 
--- 810,824 
assert_equal(['0:a', '1:b', '2:c'], l)
END
CheckDefAndScriptSuccess(lines)
+ 
+   lines =<< trim END
+   range(3)->map((a, b, c) => a + b + c)
+   END
+   CheckDefExecAndScriptFailure(lines, 'E1190: One argument too few')
+   lines =<< trim END
+   range(3)->map((a, b, c, d) => a + b + c + d)
+   END
+   CheckDefExecAndScriptFailure(lines, 'E1190: 2 arguments too few')
  enddef
  
  def Test_map_item_type()
*** ../vim-8.2.2941/src/version.c   2021-06-05 17:10:46.542051152 +0200
--- src/version.c   2021-06-05 17:30:14.551306412 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 2942,
  /**/

-- 
"I love deadlines.  I especially like the whooshing sound they
make as they go flying by."
 -- Douglas Adams

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202106051615.155GFap9078957%40masaka.moolenaar.net.


Patch 8.2.2941

2021-06-05 Fir de Conversatie Bram Moolenaar


Patch 8.2.2941
Problem:Vim9: using `=expr` does not handle a list of strings.
Solution:   Convert a list to a string and escape each item. (closes #8310)
Files:  src/vim9execute.c, src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.2940/src/vim9execute.c   2021-06-04 21:00:27.958234335 +0200
--- src/vim9execute.c   2021-06-05 17:08:09.606394715 +0200
***
*** 999,1013 
case VAR_LIST:
if (tolerant)
{
!   char_u *p;
  
str = typval2string(tv, TRUE);
clear_tv(tv);
tv->v_type = VAR_STRING;
!   tv->vval.v_string = str;
!   // TODO: escaping
!   while ((p = vim_strchr(str, '\n')) != NULL)
!   *p = ' ';
return OK;
}
// FALLTHROUGH
--- 999,1032 
case VAR_LIST:
if (tolerant)
{
!   char_u  *s, *e, *p;
!   garray_Tga;
  
+   ga_init2(, sizeof(char_u *), 1);
+ 
+   // Convert to NL separated items, then
+   // escape the items and replace the NL with
+   // a space.
str = typval2string(tv, TRUE);
+   if (str == NULL)
+   return FAIL;
+   s = str;
+   while ((e = vim_strchr(s, '\n')) != NULL)
+   {
+   *e = NUL;
+   p = vim_strsave_fnameescape(s, FALSE);
+   if (p != NULL)
+   {
+   ga_concat(, p);
+   ga_concat(, (char_u *)" ");
+   vim_free(p);
+   }
+   s = e + 1;
+   }
+   vim_free(str);
clear_tv(tv);
tv->v_type = VAR_STRING;
!   tv->vval.v_string = ga.ga_data;
return OK;
}
// FALLTHROUGH
*** ../vim-8.2.2940/src/testdir/test_vim9_cmd.vim   2021-05-09 
23:19:17.093003109 +0200
--- src/testdir/test_vim9_cmd.vim   2021-06-05 17:01:13.367479644 +0200
***
*** 34,39 
--- 34,43 
  
CheckDefFailure(['edit `=xxx`'], 'E1001:')
CheckDefFailure(['edit `="foo"'], 'E1083:')
+ 
+   var files = ['file 1', 'file%2', 'file# 3']
+   args `=files`
+   assert_equal(files, argv())
  enddef
  
  def Test_expand_alternate_file()
*** ../vim-8.2.2940/src/version.c   2021-06-05 16:25:29.189758206 +0200
--- src/version.c   2021-06-05 17:08:48.814295986 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 2941,
  /**/

-- 
   [The rest of the ARMY stand around looking at a loss.]
INSPECTOR END OF FILM: (picks up megaphone) All right!  Clear off!  Go on!
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202106051511.155FBMt8063606%40masaka.moolenaar.net.


Patch 8.2.2940

2021-06-05 Fir de Conversatie Bram Moolenaar


Patch 8.2.2940
Problem:MS-Windows: cannot see the size of the text area when resizing the
gvim window.
Solution:   Show a tooltip with the text size. (Ken Takata, closes #8326)
Files:  src/gui_w32.c


*** ../vim-8.2.2939/src/gui_w32.c   2021-06-02 13:28:11.431120460 +0200
--- src/gui_w32.c   2021-06-05 16:22:53.510159602 +0200
***
*** 2942,2948 
  int w,
  int h,
  int *valid_w,
! int *valid_h)
  {
  int   base_width, base_height;
  
--- 2942,2950 
  int w,
  int h,
  int *valid_w,
! int *valid_h,
! int *cols,
! int *rows)
  {
  int   base_width, base_height;
  
***
*** 2957,2966 
+ gui_mswin_get_menu_height(FALSE)
  #endif
;
! *valid_w = base_width +
!   ((w - base_width) / gui.char_width) * gui.char_width;
! *valid_h = base_height +
!   ((h - base_height) / gui.char_height) * gui.char_height;
  }
  
  void
--- 2959,2968 
+ gui_mswin_get_menu_height(FALSE)
  #endif
;
! *cols = (w - base_width) / gui.char_width;
! *rows = (h - base_height) / gui.char_height;
! *valid_w = base_width + *cols * gui.char_width;
! *valid_h = base_height + *rows * gui.char_height;
  }
  
  void
***
*** 4480,4485 
--- 4482,4527 
  }
  #endif
  
+ 
+ static HWND hwndTip = NULL;
+ 
+ static void
+ show_sizing_tip(int cols, int rows)
+ {
+ TOOLINFOA ti = {sizeof(ti)};
+ char buf[32];
+ 
+ ti.hwnd = s_hwnd;
+ ti.uId = (UINT_PTR)s_hwnd;
+ ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
+ ti.lpszText = buf;
+ sprintf(buf, "%dx%d", cols, rows);
+ if (hwndTip == NULL)
+ {
+   hwndTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL,
+   WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX,
+   CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+   s_hwnd, NULL, GetModuleHandle(NULL), NULL);
+   SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM));
+   SendMessage(hwndTip, TTM_TRACKACTIVATE, TRUE, (LPARAM));
+ }
+ else
+ {
+   SendMessage(hwndTip, TTM_UPDATETIPTEXT, 0, (LPARAM));
+ }
+ SendMessage(hwndTip, TTM_POPUP, 0, 0);
+ }
+ 
+ static void
+ destroy_sizing_tip(void)
+ {
+ if (hwndTip != NULL)
+ {
+   DestroyWindow(hwndTip);
+   hwndTip = NULL;
+ }
+ }
+ 
  static int
  _DuringSizing(
  UINT fwSide,
***
*** 4488,4497 
  int   w, h;
  int   valid_w, valid_h;
  int   w_offset, h_offset;
  
  w = lprc->right - lprc->left;
  h = lprc->bottom - lprc->top;
! gui_mswin_get_valid_dimensions(w, h, _w, _h);
  w_offset = w - valid_w;
  h_offset = h - valid_h;
  
--- 4530,4540 
  int   w, h;
  int   valid_w, valid_h;
  int   w_offset, h_offset;
+ int   cols, rows;
  
  w = lprc->right - lprc->left;
  h = lprc->bottom - lprc->top;
! gui_mswin_get_valid_dimensions(w, h, _w, _h, , );
  w_offset = w - valid_w;
  h_offset = h - valid_h;
  
***
*** 4508,4513 
--- 4551,4558 
  else if (fwSide == WMSZ_BOTTOM || fwSide == WMSZ_BOTTOMLEFT
|| fwSide == WMSZ_BOTTOMRIGHT)
lprc->bottom -= h_offset;
+ 
+ show_sizing_tip(cols, rows);
  return TRUE;
  }
  
***
*** 4648,4653 
--- 4693,4702 
return 0L;
  #endif
  
+ case WM_EXITSIZEMOVE:
+   destroy_sizing_tip();
+   break;
+ 
  case WM_SIZING:   // HANDLE_MSG doesn't seem to handle this one
return _DuringSizing((UINT)wParam, (LPRECT)lParam);
  
*** ../vim-8.2.2939/src/version.c   2021-06-05 16:06:36.965265806 +0200
--- src/version.c   2021-06-05 16:24:59.605833636 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 2940,
  /**/

-- 
ARTHUR: CHARGE!
   [The mighty ARMY charges.  Thundering noise of feet.  Clatter of coconuts.
   Shouts etc.   Suddenly there is a wail of a siren and a couple of police
   cars roar round in front of the charging ARMY and the POLICE leap out and
   stop them.  TWO POLICEMAN and the HISTORIAN'S WIFE.  Black Marias skid up
   behind them.]
HISTORIAN'S WIFE: They're the ones, I'm sure.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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 

Patch 8.2.2939

2021-06-05 Fir de Conversatie Bram Moolenaar


Patch 8.2.2939
Problem:GTK: righthand scrollbar does not show with split window.
Solution:   Adjust padding when two scrollbars are used. (Matt Wozniski,
closes #8324)
Files:  src/gui_gtk.c


*** ../vim-8.2.2938/src/gui_gtk.c   2021-04-05 18:20:42.024142486 +0200
--- src/gui_gtk.c   2021-06-05 15:59:33.067260655 +0200
***
*** 1050,1055 
--- 1050,1058 
  xpad = gui.formwin->allocation.width - gui.drawarea->allocation.width
 - gui.scrollbar_width;
  #endif
+ if (gui.which_scrollbars[SBAR_LEFT] && gui.which_scrollbars[SBAR_RIGHT])
+   xpad -= gui.scrollbar_width;
+ 
  return (xpad < 0) ? 0 : xpad;
  }
  
*** ../vim-8.2.2938/src/version.c   2021-06-04 21:57:53.935646716 +0200
--- src/version.c   2021-06-05 16:00:42.523061582 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 2939,
  /**/

-- 
Why is "abbreviation" such a long word?

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202106051408.155E8FST049684%40masaka.moolenaar.net.