[patch] doc fixes

2020-10-04 Fir de Conversatie Dominique Pellé
Hi

Attached are documentation fixes for vim-8.2.1801.

Regards
Dominique

-- 
-- 
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/CAON-T_g%2BNSmtCgujXZjVrP1FF1tHmBqR1PvJ%3DGwYAYuDt0hdvA%40mail.gmail.com.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index b2b16007e..15519f840 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -3503,7 +3503,7 @@ byteidxcomp({expr}, {nr})	*byteidxcomp()*
 <		The first and third echo result in 3 ('e' plus composing
 		character is 3 bytes), the second echo results in 1 ('e' is
 		one byte).
-		Only works different from byteidx() when 'encoding' is set to
+		Only works differently from byteidx() when 'encoding' is set to
 		a Unicode encoding.
 
 		Can also be used as a |method|: >
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 713f3ba3e..fe17b60e5 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -2554,7 +2554,7 @@ A jump table for the options with a short description can be found at |Q_op|.
 	"x" delete each combining character on its own.  When it is off (the
 	default) the character along with its combining characters are
 	deleted.
-	Note: When 'delcombine' is set "xx" may work different from "2x"!
+	Note: When 'delcombine' is set "xx" may work differently from "2x"!
 
 	This is useful for Arabic, Hebrew and many other languages where one
 	may have combining characters overtop of base characters, and want
diff --git a/runtime/doc/version8.txt b/runtime/doc/version8.txt
index 6192c237e..431b9cd47 100644
--- a/runtime/doc/version8.txt
+++ b/runtime/doc/version8.txt
@@ -48515,7 +48515,7 @@ Solution:   Recognize true and false.
 Files:  src/eval.c, src/testdir/test_vim9_expr.vim
 
 Patch 8.2.1205
-Problem:Vim9: && and || work different when not compiled.
+Problem:Vim9: && and || work differently when not compiled.
 Solution:   Keep the value.
 Files:  src/eval.c, src/testdir/test_vim9_expr.vim
 
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index feb889dad..b2dd12e8f 100644
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -1140,7 +1140,7 @@ Two alternatives were considered:
 	def Func(arg1 number, arg2 string) bool
 
 The first is more familiar for anyone used to C or Java.  The second one
-doesn't really has an advantage over the first, so let's discard the second.
+doesn't really have an advantage over the first, so let's discard the second.
 
 Since we use type inference the type can be left out when it can be inferred
 from the value.  This means that after `var` we don't know if a type or a name


Re: Vim9: rethinking conditions and boolean expressions

2020-10-04 Fir de Conversatie Bram Moolenaar


> In javascript you can use !! operator to always convert it to boolean.
> 
> var name = ''
> var nameExists = !!(name || 'Prabir')

Yes, and I think we should do the same.  It should already work like
that now.

Thus in most places where a condition is expected, such as with ":if"
and ":while", a boolean is expected.  With legacy script you could use a
string, which was converted to a number and easily leads to mistakes.
Also numbers could be used.  With Vim9 script only the numbers zero and
one can be used.  This avoids making mistakes, but it's a bit strict.

The new "??" operator can be used with any expression.  Just like with
"!" accepts any expression.  In these places the expression is tested to
be "falsy" or "truthy".

I might have missed something, we might need a few more tests.


-- 
hundred-and-one symptoms of being an internet addict:
32. You don't know what sex three of your closest friends are, because they
have neutral nicknames and you never bothered to ask.

 /// 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202010042147.094Ll6Gh2232566%40masaka.moolenaar.net.


Re: Vim9: rethinking conditions and boolean expressions

2020-10-04 Fir de Conversatie ma...@prabir.me
In javascript you can use !! operator to always convert it to boolean.

var name = ''
var nameExists = !!(name || 'Prabir')

On Saturday, October 3, 2020 at 12:25:21 PM UTC-7 Andy Wokula wrote:

> Am 03.10.2020 um 17:44 schrieb Bram Moolenaar:
> > Therefore, I'm going to make && and || have a boolean result again.
> > I think that is the easiest to understand, and what most languages do.
>
> +100
>
> -- 
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/d82bdde2-4327-4907-a866-d57faf95ed2dn%40googlegroups.com.


Patch 8.2.1801

2020-10-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.1801
Problem:Undo file not found when using ":args" or ":next".
Solution:   Handle like editing another file. (closes #7072)
Files:  src/ex_cmds.c, src/testdir/test_undo.vim


*** ../vim-8.2.1800/src/ex_cmds.c   2020-08-15 16:33:24.497747330 +0200
--- src/ex_cmds.c   2020-10-04 19:56:00.319991178 +0200
***
*** 2849,2857 
new_name = NULL;
set_bufref(, buf);
  
!   if (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur)
{
-   // Save all the text, so that the reload can be undone.
// Sync first so that this is a separate undo-able action.
u_sync(FALSE);
if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, TRUE)
--- 2849,2860 
new_name = NULL;
set_bufref(, buf);
  
!   // If the buffer was used before, store the current contents so that
!   // the reload can be undone.  Do not do this if the (empty) buffer is
!   // being re-used for another file.
!   if (!(curbuf->b_flags & BF_NEVERLOADED)
!   && (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur))
{
// Sync first so that this is a separate undo-able action.
u_sync(FALSE);
if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, TRUE)
*** ../vim-8.2.1800/src/testdir/test_undo.vim   2020-04-12 13:50:22.832171856 
+0200
--- src/testdir/test_undo.vim   2020-10-04 18:03:19.690176432 +0200
***
*** 396,401 
--- 396,421 
call delete('Xundofile')
  endfunc
  
+ func Test_undofile_next()
+   set undofile
+   new Xfoo.txt
+   execute "norm ix\uy\uz\"
+   write
+   bwipe
+ 
+   next Xfoo.txt
+   call assert_equal('xyz', getline(1))
+   silent undo
+   call assert_equal('xy', getline(1))
+   silent undo
+   call assert_equal('x', getline(1))
+   bwipe!
+ 
+   call delete('Xfoo.txt')
+   call delete('.Xfoo.txt.un~')
+   set undofile&
+ endfunc
+ 
  " Test for undo working properly when executing commands from a register.
  " Also test this in an empty buffer.
  func Test_cmd_in_reg_undo()
*** ../vim-8.2.1800/src/version.c   2020-10-04 17:24:24.705711322 +0200
--- src/version.c   2020-10-04 18:02:48.954270297 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 1801,
  /**/

-- 
If you put 7 of the most talented OSS developers in a room for a week
and asked them to fix a bug in a spreadsheet program, in 1 week
you'd have 2 new mail readers and a text-based web browser.

 /// 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202010041759.094HxKqY2187317%40masaka.moolenaar.net.


Patch 8.2.1800

2020-10-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.1800
Problem:Vim9: memory leak if "if" condition is invalid.
Solution:   Free ppconst earlier.
Files:  src/vim9compile.c


*** ../vim-8.2.1799/src/vim9compile.c   2020-10-04 16:06:00.513884339 +0200
--- src/vim9compile.c   2020-10-04 17:17:44.058727117 +0200
***
*** 5721,5730 
  
// The expression results in a constant.
v = tv_get_bool_chk(_tv[0], );
if (error)
return NULL;
cctx->ctx_skip = v ? SKIP_NOT : SKIP_YES;
-   clear_ppconst();
  }
  else
  {
--- 5721,5730 
  
// The expression results in a constant.
v = tv_get_bool_chk(_tv[0], );
+   clear_ppconst();
if (error)
return NULL;
cctx->ctx_skip = v ? SKIP_NOT : SKIP_YES;
  }
  else
  {
*** ../vim-8.2.1799/src/version.c   2020-10-04 16:16:50.919838655 +0200
--- src/version.c   2020-10-04 17:19:12.698507185 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 1800,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
29. Your phone bill comes to your doorstep in a box.

 /// 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202010041525.094FPAmV2142493%40masaka.moolenaar.net.


Patch 8.2.1799

2020-10-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.1799
Problem:Some Normal mode commands not fully tested.
Solution:   Add a few more tests. (Yegappan Lakshmanan, closes #7073)
Files:  src/testdir/test_gf.vim, src/testdir/test_goto.vim,
src/testdir/test_normal.vim, src/testdir/test_registers.vim,
src/testdir/test_startup.vim, src/testdir/test_tabpage.vim,
src/testdir/test_visual.vim


*** ../vim-8.2.1798/src/testdir/test_gf.vim 2020-09-14 19:11:41.698381689 
+0200
--- src/testdir/test_gf.vim 2020-10-04 16:14:00.528370482 +0200
***
*** 183,188 
--- 183,203 
au! InsertCharPre
  
bwipe!
+ 
+   " gf is not allowed when buffer is locked
+   new
+   augroup Test_gf
+ au!
+ au OptionSet diff norm! gf
+   augroup END
+   call setline(1, ['Xfile1', 'line2', 'line3', 'line4'])
+   call test_override('starting', 1)
+   call assert_fails('diffthis', 'E788:')
+   call test_override('starting', 0)
+   augroup Test_gf
+ au!
+   augroup END
+   bw!
  endfunc
  
  " If a file is not found by 'gf', then 'includeexpr' should be used to locate
*** ../vim-8.2.1798/src/testdir/test_goto.vim   2020-04-28 20:29:04.237851565 
+0200
--- src/testdir/test_goto.vim   2020-10-04 16:14:00.528370482 +0200
***
*** 122,127 
--- 122,145 
call XTest_goto_decl('gd', lines, 3, 14)
  endfunc
  
+ " Using gd to jump to a declaration in a fold
+ func Test_gd_with_fold()
+   new
+   let lines =<< trim END
+ #define ONE 1
+ #define TWO 2
+ #define THREE 3
+ 
+ TWO
+   END
+   call setline(1, lines)
+   1,3fold
+   call feedkeys('Ggd', 'xt')
+   call assert_equal(2, line('.'))
+   call assert_equal(-1, foldclosedend(2))
+   bw!
+ endfunc
+ 
  func Test_gd_not_local()
let lines =<< trim [CODE]
  int func1(void)
*** ../vim-8.2.1798/src/testdir/test_normal.vim 2020-10-02 18:48:02.846263669 
+0200
--- src/testdir/test_normal.vim 2020-10-04 16:14:00.528370482 +0200
***
*** 434,439 
--- 434,451 
call assert_equal(3, line('$'))
exe "norm! 0d3\2l"
call assert_equal('obar2foobar3', getline('.'))
+   " test for the visual block size displayed in the status line
+   call setline(1, ['a', 'b', 'c'])
+   call feedkeys("ggl\lljj", 'xt')
+   redraw!
+   call assert_match('3x3$', Screenline())
+   call feedkeys("\", 'xt')
+   " test for visually selecting a multi-byte character
+   call setline(1, ["\U2206"])
+   call feedkeys("ggv", 'xt')
+   redraw!
+   call assert_match('1-3$', Screenline())
+   call feedkeys("v", 'xt')
bw!
  endfunc
  
***
*** 838,843 
--- 850,867 
exe "normal \\"
call assert_equal(h + 1, line('w$'))
  
+   " Test for CTRL-Y from the first line and CTRL-E from the last line
+   %d
+   set scrolloff=2
+   call setline(1, range(1, 4))
+   exe "normal gg\"
+   call assert_equal(1, line('w0'))
+   call assert_equal(1, line('.'))
+   exe "normal G4\\"
+   call assert_equal(4, line('w$'))
+   call assert_equal(4, line('.'))
+   set scrolloff&
+ 
" Using  and  in an empty buffer should beep
%d
call assert_beeps('exe "normal \"')
***
*** 886,891 
--- 910,927 
exe "normal \"
call assert_equal(50, line('w0'))
  
+   " Test for . Page down.
+   %d
+   call setline(1, range(1, 100))
+   call feedkeys("\", 'xt')
+   call assert_equal(14, line('w0'))
+   call assert_equal(28, line('w$'))
+ 
+   " Test for . Page up.
+   call feedkeys("\", 'xt')
+   call assert_equal(1, line('w0'))
+   call assert_equal(15, line('w$'))
+ 
set foldenable&
close!
  endfunc
***
*** 1856,1862 
close!
  endfunc
  
! " Test for ~ command
  func Test_normal30_changecase()
new
call append(0, 'This is a simple test: äüöß')
--- 1892,1898 
close!
  endfunc
  
! " Test for changing case using u, U, gu, gU and ~ (tilde) commands
  func Test_normal30_changecase()
new
call append(0, 'This is a simple test: äüöß')
***
*** 1876,1881 
--- 1912,1920 
call assert_equal('this is a SIMPLE TEST: ÄÜÖSS', getline('.'))
norm! V~
call assert_equal('THIS IS A simple test: äüöss', getline('.'))
+   call assert_beeps('norm! c~')
+   %d
+   call assert_beeps('norm! ~')
  
" Test for changing case across lines using 'whichwrap'
call setline(1, ['aa', 'aa'])
*** ../vim-8.2.1798/src/testdir/test_registers.vim  2020-10-02 
18:48:02.846263669 +0200
--- src/testdir/test_registers.vim  2020-10-04 16:14:00.528370482 +0200
***
*** 274,279 
--- 274,282 
call assert_fails('let r = getreg("=", [])', 'E745:')
call assert_fails('let r = getreg("=", 1, [])', 'E745:')
enew!
+ 
+   " Using a register in operator-pending mode should fail
+   call assert_beeps('norm! c"')
  endfunc
  
  func Test_set_register()
*** ../vim-8.2.1798/src/testdir/test_startup.vim2020-08-12 
18:50:31.887655765 +0200
--- src/testdir/test_startup.vim2020-10-04 16:14:00.528370482 

Patch 8.2.1798

2020-10-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.1798
Problem:Vim9: trinary operator condition is too permissive.
Solution:   Use tv_get_bool_chk().
Files:  runtime/doc/vim9.txt, src/eval.c, src/vim9compile.c,
src/vim9execute.c, src/testdir/vim9.vim,
src/testdir/test_expr.vim, src/testdir/test_vim9_expr.vim,
src/testdir/test_vim9_cmd.vim, src/testdir/test_vim9_script.vim


*** ../vim-8.2.1797/runtime/doc/vim9.txt2020-10-03 22:51:42.890813408 
+0200
--- runtime/doc/vim9.txt2020-10-04 15:21:54.182614262 +0200
***
*** 164,178 
  
  When using `:function` or `:def` to specify a nested function inside a `:def`
  function, this nested function is local to the code block it is defined in.
! In a `:def` function IT is not possible to define a script-local function.  it
  is possible to define a global function by using the "g:" prefix.
  
  When referring to a function and no "s:" or "g:" prefix is used, Vim will
! prefer using a local function (in the function scope, script scope or
! imported) before looking for a global function.  However, it is recommended to
! always use "g:" to refer to a local function for clarity.  In all cases the
! function must be defined before used.  That is when it is first called or when
! `:defcompile` causes the call to be compiled.
  
  The result is that functions and variables without a namespace can usually be
  found in the script, either defined there or imported.  Global functions and
--- 164,183 
  
  When using `:function` or `:def` to specify a nested function inside a `:def`
  function, this nested function is local to the code block it is defined in.
! In a `:def` function it is not possible to define a script-local function.  it
  is possible to define a global function by using the "g:" prefix.
  
  When referring to a function and no "s:" or "g:" prefix is used, Vim will
! search for the function:
! - in the function scope
! - in the script scope, possibly imported
! - in the list of global functions
! However, it is recommended to always use "g:" to refer to a global function
! for clarity.
! 
! In all cases the function must be defined before used.  That is when it is
! called, when `:defcompile` causes the it to be compiled, or when code that
! calls it is being compiled (to figure out the return type).
  
  The result is that functions and variables without a namespace can usually be
  found in the script, either defined there or imported.  Global functions and
***
*** 467,477 
  
  Conditions and expressions ~
  
! Conditions and expressions are mostly working like they do in JavaScript.  A
! difference is made where JavaScript does not work like most people expect.
! Specifically, an empty list is falsy.
  
!   typeTRUE when ~
boolv:true or 1
number  non-zero
float   non-zero
--- 472,492 
  
  Conditions and expressions ~
  
! Conditions and expressions are mostly working like they do in other languages.
! Some values are different from legacy Vim script:
!   value   legacy Vim script   Vim9 script ~
!   0   falsy   falsy
!   1   truthy  truthy
!   99  truthy  Error!
!   "0" falsy   Error!
!   "99"truthy  Error!
!   "text"  falsy   Error!
! 
! For the "??" operator and when using "!" then there is no error, every value
! is either falsy or truthy.  This is mostly like JavaScript, except that an
! empty list and dict is falsy:
  
!   typetruthy when ~
boolv:true or 1
number  non-zero
float   non-zero
***
*** 498,510 
[] || 99 Error!
  
  When using "!" for inverting, there is no error for using any type and the
! result is a boolean: >
!'yes'  == false
!   var myList = [1, 2, 3]
!   !!myList== true
  
  When using "`.."` for string concatenation arguments of simple types are
! always converted to string. >
'hello ' .. 123  == 'hello 123'
'hello ' .. v:true  == 'hello v:true'
  
--- 513,525 
[] || 99 Error!
  
  When using "!" for inverting, there is no error for using any type and the
! result is a boolean.  "!!" can be used to turn any value into boolean: >
!'yes'  == false
!   !![]== false
!   !![1, 2, 3] == true
  
  When using "`.."` for string concatenation arguments of simple types are
! always converted to string: >
'hello ' .. 123  == 'hello 123'
'hello ' .. v:true  == 'hello v:true'
  
*** ../vim-8.2.1797/src/eval.c  2020-10-03 22:51:42.890813408 +0200
--- src/eval.c  2020-10-04 15:32:53.648263271 +0200
***
*** 191,197 
if (!skip)
{

Re: Haskell and cabal syntax files

2020-10-04 Fir de Conversatie Bram Moolenaar


Marcin Szamotulski wrote:

> I attach updated syntax files for haskell and cabal.

Thanks, I'll include them.  I'll update the date in the cabal file.

-- 
Tips for aliens in New York: Land anywhere.  Central Park, anywhere.
No one will care or indeed even notice.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202010041310.094DAWBq2110537%40masaka.moolenaar.net.


Patch 8.2.1797

2020-10-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.1797
Problem:Vim9: some parts of the code not tested.
Solution:   Add a few tests.
Files:  src/testdir/test_vim9_func.vim


*** ../vim-8.2.1796/src/testdir/test_vim9_func.vim  2020-10-04 
13:42:30.299568231 +0200
--- src/testdir/test_vim9_func.vim  2020-10-04 14:13:18.673865650 +0200
***
*** 1056,1061 
--- 1056,1063 
CheckDefFailure(['var RefAny: func(): any', 'RefAny = FuncNoArgNoRet'], 
'E1012: Type mismatch; expected func(): any but got func()')
CheckDefFailure(['var RefAny: func(): any', 'RefAny = FuncOneArgNoRet'], 
'E1012: Type mismatch; expected func(): any but got func(number)')
  
+   var RefAnyNoArgs: func: any = RefAny
+ 
var RefNr: func: number
RefNr = FuncNoArgRetNumber
RefNr = FuncOneArgRetNumber
***
*** 1100,1105 
--- 1102,1123 
CheckDefFailure(['var str: string', 'str = FuncNoArgRetNumber()'], 'E1012: 
Type mismatch; expected string but got number')
  enddef
  
+ def Test_func_common_type()
+   def FuncOne(n: number): number
+ return n
+   enddef
+   def FuncTwo(s: string): number
+ return len(s)
+   enddef
+   def FuncThree(n: number, s: string): number
+ return n + len(s)
+   enddef
+   var list = [FuncOne, FuncTwo, FuncThree]
+   assert_equal(8, list[0](8))
+   assert_equal(4, list[1]('word'))
+   assert_equal(7, list[2](3, 'word'))
+ enddef
+ 
  def MultiLine(
  arg1: string,
  arg2 = 1234,
***
*** 1948,1953 
--- 1966,1974 
Xsetlist = function('setqflist', [[], ' '])
Xsetlist({'title': 'test'})
getqflist({'title': 1})->assert_equal({'title': 'test'})
+ 
+   var Len: func: number = function('len', ['word'])
+   assert_equal(4, Len())
  enddef
  
  def Test_cmd_modifier()
*** ../vim-8.2.1796/src/version.c   2020-10-04 13:42:30.299568231 +0200
--- src/version.c   2020-10-04 14:17:09.881404502 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 1797,
  /**/

-- 
Time is an illusion.  Lunchtime doubly so.
-- Ford Prefect, in Douglas Adams'
   "The Hitchhiker's Guide to the Galaxy"

 /// 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202010041218.094CI0l92099153%40masaka.moolenaar.net.


Patch 8.2.1796

2020-10-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.1796
Problem:Vim9: invalid memory access with weird function name. (Dhiraj
Mishra)
Solution:   Check the name is valid.  Add a test.
Files:  src/userfunc.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.1795/src/userfunc.c  2020-09-27 15:19:23.642118924 +0200
--- src/userfunc.c  2020-10-04 13:36:48.741129200 +0200
***
*** 2374,2379 
--- 2374,2380 
  int   extra = 0;
  lval_Tlv;
  int   vim9script;
+ static char *e_function_name = N_("E129: Function name required");
  
  if (fdp != NULL)
CLEAR_POINTER(fdp);
***
*** 2401,2407 
  if (end == start)
  {
if (!skip)
!   emsg(_("E129: Function name required"));
goto theend;
  }
  if (end == NULL || (lv.ll_tv != NULL && (lead > 2 || lv.ll_range)))
--- 2402,2408 
  if (end == start)
  {
if (!skip)
!   emsg(_(e_function_name));
goto theend;
  }
  if (end == NULL || (lv.ll_tv != NULL && (lead > 2 || lv.ll_range)))
***
*** 2517,2522 
--- 2518,2529 
}
len = (int)(end - lv.ll_name);
  }
+ if (len <= 0)
+ {
+   if (!skip)
+   emsg(_(e_function_name));
+   goto theend;
+ }
  
  // In Vim9 script a user function is script-local by default.
  vim9script = ASCII_ISUPPER(*start) && in_vim9script();
*** ../vim-8.2.1795/src/testdir/test_vim9_func.vim  2020-10-01 
21:37:17.798009505 +0200
--- src/testdir/test_vim9_func.vim  2020-10-04 13:39:32.408333755 +0200
***
*** 1906,1911 
--- 1906,1937 
delete('XclosureDir', 'rf')
  enddef
  
+ def Test_invalid_function_name()
+   var lines =<< trim END
+   vim9script
+   def s: list
+   END
+   CheckScriptFailure(lines, 'E129:')
+ 
+   lines =<< trim END
+   vim9script
+   def g: list
+   END
+   CheckScriptFailure(lines, 'E129:')
+ 
+   lines =<< trim END
+   vim9script
+   def : list
+   END
+   CheckScriptFailure(lines, 'E884:')
+ 
+   lines =<< trim END
+   vim9script
+   def F list
+   END
+   CheckScriptFailure(lines, 'E488:')
+ enddef
+ 
  def Test_partial_call()
var Xsetlist = function('setloclist', [0])
Xsetlist([], ' ', {'title': 'test'})
*** ../vim-8.2.1795/src/version.c   2020-10-03 22:51:42.894813399 +0200
--- src/version.c   2020-10-04 13:42:07.855660263 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 1796,
  /**/

-- 
This planet has -- or rather had -- a problem, which was this: most
of the people living on it were unhappy for pretty much of the time.
Many solutions were suggested for this problem, but most of these
were largely concerned with the movements of small green pieces of
paper, which is odd because on the whole it wasn't the small green
pieces of paper that were unhappy.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202010041144.094BiLQX2092876%40masaka.moolenaar.net.


Haskell and cabal syntax files

2020-10-04 Fir de Conversatie 'Marcin Szamotulski' via vim_dev
Hi Bram,

I attach updated syntax files for haskell and cabal.

Best regards,
Marcin Szamotulski

-- 
-- 
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/ZLoRFo8Lc1JTG0sM0MW1E2YaBdIG_khab8uDkSLwN9UW7NocAApcALoyylQqVUxyXkkiiYOr1zflAa80oJNL24tbVQdXH0bTkU778St6I0Y%3D%40pm.me.


cabal.vim
Description: Binary data


haskell.vim
Description: Binary data


signature.asc
Description: OpenPGP digital signature