Patch 8.2.2199

7 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 23, 2020, 12:55:37 PM12/23/20
to vim...@googlegroups.com

Patch 8.2.2199
Problem: First write after setting 'eol' does not have NL added. (Tomáš
Janoušek)
Solution: Only use b_no_eol_lnum when doing a binary write. (closes #7535)
Files: src/bufwrite.c, src/testdir/test_writefile.vim


*** ../vim-8.2.2198/src/bufwrite.c 2020-12-18 19:49:52.337571884 +0100
--- src/bufwrite.c 2020-12-23 18:48:59.402936918 +0100
***************
*** 2031,2037 ****
if (end == 0
|| (lnum == end
&& (write_bin || !buf->b_p_fixeol)
! && (lnum == buf->b_no_eol_lnum
|| (lnum == buf->b_ml.ml_line_count
&& !buf->b_p_eol))))
{
--- 2031,2037 ----
if (end == 0
|| (lnum == end
&& (write_bin || !buf->b_p_fixeol)
! && ((write_bin && lnum == buf->b_no_eol_lnum)
|| (lnum == buf->b_ml.ml_line_count
&& !buf->b_p_eol))))
{
*** ../vim-8.2.2198/src/testdir/test_writefile.vim 2020-09-04 21:18:40.492161906 +0200
--- src/testdir/test_writefile.vim 2020-12-23 18:49:48.254787611 +0100
***************
*** 676,679 ****
--- 676,697 ----
%bw!
endfunc

+ func Test_read_write_bin()
+ " write file missing EOL
+ call writefile(['noeol'], "XNoEolSetEol", 'bS')
+ call assert_equal(0z6E6F656F6C, readfile('XNoEolSetEol', 'B'))
+
+ " when file is read 'eol' is off
+ set ff=unix nofixeol
+ e XNoEolSetEol
+ call assert_equal(0, &eol)
+
+ " writing with 'eol' set adds the newline
+ setlocal eol
+ w
+ call assert_equal(0z6E6F656F6C0A, readfile('XNoEolSetEol', 'B'))
+
+ call delete('XNoEolSetEol')
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2198/src/version.c 2020-12-23 14:35:56.963016983 +0100
--- src/version.c 2020-12-23 18:51:06.278547383 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2199,
/**/

--
hundred-and-one symptoms of being an internet addict:
19. All of your friends have an @ in their names.

/// Bram Moolenaar -- Br...@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 ///

Bram Moolenaar

unread,
Dec 23, 2020, 2:28:27 PM12/23/20
to vim...@googlegroups.com

Patch 8.2.2200
Problem: Vim9: lambda without white space around -> is confusing.
Solution: Require white space in a :def funtion. (issue #7503)
Files: src/vim9compile.c, src/testdir/test_vim9_expr.vim,
src/testdir/test_vim9_disassemble.vim


*** ../vim-8.2.2199/src/vim9compile.c 2020-12-22 18:56:52.055797690 +0100
--- src/vim9compile.c 2020-12-23 20:23:19.102336162 +0100
***************
*** 3915,3928 ****
* Dictionary: {'key': val, 'key': val}
*/
case '{': {
! char_u *start = skipwhite(*arg + 1);
! garray_T ga_arg;

// Find out what comes after the arguments.
! ret = get_function_args(&start, '-', NULL,
&ga_arg, TRUE, NULL, NULL,
TRUE, NULL, NULL);
! if (ret != FAIL && *start == '>')
ret = compile_lambda(arg, cctx);
else
ret = compile_dict(arg, cctx, ppconst);
--- 3915,3933 ----
* Dictionary: {'key': val, 'key': val}
*/
case '{': {
! char_u *start = skipwhite(*arg + 1);
! char_u *after = start;
! garray_T ga_arg;

// Find out what comes after the arguments.
! ret = get_function_args(&after, '-', NULL,
&ga_arg, TRUE, NULL, NULL,
TRUE, NULL, NULL);
! if (ret != FAIL && after[0] == '>'
! && ((after > start + 2
! && VIM_ISWHITE(after[-2]))
! || after == start + 1)
! && IS_WHITE_OR_NUL(after[1]))
ret = compile_lambda(arg, cctx);
else
ret = compile_dict(arg, cctx, ppconst);
*** ../vim-8.2.2199/src/testdir/test_vim9_expr.vim 2020-12-15 21:41:53.141431375 +0100
--- src/testdir/test_vim9_expr.vim 2020-12-23 20:25:07.121990643 +0100
***************
*** 1863,1868 ****
--- 1863,1872 ----
END
CheckDefAndScriptSuccess(lines)

+ CheckDefFailure(["var Ref = {a->a + 1}"], 'E720:')
+ CheckDefFailure(["var Ref = {a-> a + 1}"], 'E720:')
+ CheckDefFailure(["var Ref = {a ->a + 1}"], 'E720:')
+
CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:', 1)
# error is in first line of the lambda
CheckDefFailure(["var L = {a -> a + b}"], 'E1001:', 0)
***************
*** 2538,2544 ****
call CheckDefFailure(["'yes'->", "Echo()"], 'E488: Trailing characters: ->', 1)

call CheckDefExecFailure(["[1, 2->len()"], 'E697:', 2)
! call CheckDefExecFailure(["{a: 1->len()"], 'E451:', 1)
call CheckDefExecFailure(["{['a']: 1->len()"], 'E723:', 2)
endfunc

--- 2542,2548 ----
call CheckDefFailure(["'yes'->", "Echo()"], 'E488: Trailing characters: ->', 1)

call CheckDefExecFailure(["[1, 2->len()"], 'E697:', 2)
! call CheckDefExecFailure(["{a: 1->len()"], 'E723:', 2)
call CheckDefExecFailure(["{['a']: 1->len()"], 'E723:', 2)
endfunc

*** ../vim-8.2.2199/src/testdir/test_vim9_disassemble.vim 2020-12-21 17:30:46.941668485 +0100
--- src/testdir/test_vim9_disassemble.vim 2020-12-23 20:26:09.673788774 +0100
***************
*** 1541,1550 ****
['{a: 1} is aDict', 'COMPAREDICT is'],
['{a: 1} isnot aDict', 'COMPAREDICT isnot'],

! ['{->33} == {->44}', 'COMPAREFUNC =='],
! ['{->33} != {->44}', 'COMPAREFUNC !='],
! ['{->33} is {->44}', 'COMPAREFUNC is'],
! ['{->33} isnot {->44}', 'COMPAREFUNC isnot'],

['77 == g:xx', 'COMPAREANY =='],
['77 != g:xx', 'COMPAREANY !='],
--- 1541,1550 ----
['{a: 1} is aDict', 'COMPAREDICT is'],
['{a: 1} isnot aDict', 'COMPAREDICT isnot'],

! ['{-> 33} == {-> 44}', 'COMPAREFUNC =='],
! ['{-> 33} != {-> 44}', 'COMPAREFUNC !='],
! ['{-> 33} is {-> 44}', 'COMPAREFUNC is'],
! ['{-> 33} isnot {-> 44}', 'COMPAREFUNC isnot'],

['77 == g:xx', 'COMPAREANY =='],
['77 != g:xx', 'COMPAREANY !='],
*** ../vim-8.2.2199/src/version.c 2020-12-23 18:54:53.569837273 +0100
--- src/version.c 2020-12-23 20:20:16.114910167 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2200,
/**/

--
When a fly lands on the ceiling, does it do a half roll or
a half loop?
Reply all
Reply to author
Forward
0 new messages