To: vim_dev@googlegroups.com Subject: Patch 8.2.1026 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1026 Problem: Vim9: cannot break the line after "->". Solution: Check for a continuation line after "->", "[" and ".". Ignore trailing white space. Files: src/vim9compile.c, src/testdir/test_vim9_expr.vim *** ../vim-8.2.1025/src/vim9compile.c 2020-06-20 22:50:44.175608236 +0200 --- src/vim9compile.c 2020-06-21 14:06:58.331657411 +0200 *************** *** 3538,3544 **** return FAIL; *start_leader = end_leader; // don't apply again later ! *arg = skipwhite(*arg + 2); if (**arg == '{') { // lambda call: list->{lambda} --- 3538,3547 ---- return FAIL; *start_leader = end_leader; // don't apply again later ! p = *arg + 2; ! *arg = skipwhite(p); ! if (may_get_next_line(p, arg, cctx) == FAIL) ! return FAIL; if (**arg == '{') { // lambda call: list->{lambda} *************** *** 3567,3572 **** --- 3570,3576 ---- { garray_T *stack = &cctx->ctx_type_stack; type_T **typep; + char_u *p; // list index: list[123] // dict member: dict[key] *************** *** 3576,3582 **** if (generate_ppconst(cctx, ppconst) == FAIL) return FAIL; ! *arg = skipwhite(*arg + 1); if (compile_expr0(arg, cctx) == FAIL) return FAIL; --- 3580,3589 ---- if (generate_ppconst(cctx, ppconst) == FAIL) return FAIL; ! p = *arg + 1; ! *arg = skipwhite(p); ! if (may_get_next_line(p, arg, cctx) == FAIL) ! return FAIL; if (compile_expr0(arg, cctx) == FAIL) return FAIL; *************** *** 3617,3624 **** return FAIL; ++*arg; ! p = *arg; // dictionary member: dict.name if (eval_isnamec1(*p)) while (eval_isnamec(*p)) MB_PTR_ADV(p); --- 3624,3633 ---- return FAIL; ++*arg; ! if (may_get_next_line(*arg, arg, cctx) == FAIL) ! return FAIL; // dictionary member: dict.name + p = *arg; if (eval_isnamec1(*p)) while (eval_isnamec(*p)) MB_PTR_ADV(p); *************** *** 6664,6670 **** if (line != NULL && *line == '|') // the line continues after a '|' ++line; ! else if (line != NULL && *line != NUL && !(*line == '#' && (line == cctx.ctx_line_start || VIM_ISWHITE(line[-1])))) { --- 6673,6679 ---- if (line != NULL && *line == '|') // the line continues after a '|' ++line; ! else if (line != NULL && *skipwhite(line) != NUL && !(*line == '#' && (line == cctx.ctx_line_start || VIM_ISWHITE(line[-1])))) { *** ../vim-8.2.1025/src/testdir/test_vim9_expr.vim 2020-06-19 18:34:10.993945080 +0200 --- src/testdir/test_vim9_expr.vim 2020-06-21 14:08:01.203459051 +0200 *************** *** 1029,1034 **** --- 1029,1049 ---- assert_equal(123, d.key) enddef + def Test_expr7_subscript_linebreak() + let range = range( + 3) + let l = range-> + map('string(v:key)') + assert_equal(['0', '1', '2'], l) + + assert_equal('1', l[ + 1]) + + let d = #{one: 33} + assert_equal(33, d. + one) + enddef + func Test_expr7_trailing_fails() call CheckDefFailure(['let l = [2]', 'l->{l -> add(l, 8)}'], 'E107') *** ../vim-8.2.1025/src/version.c 2020-06-21 13:23:42.067290841 +0200 --- src/version.c 2020-06-21 14:11:08.434872442 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1026, /**/ -- BROTHER MAYNARD: Armaments Chapter Two Verses Nine to Twenty One. ANOTHER MONK: And St. Attila raised his hand grenade up on high saying "O Lord bless this thy hand grenade that with it thou mayest blow thine enemies to tiny bits, in thy mercy. "and the Lord did grin and people did feast upon the lambs and sloths and carp and anchovies and orang-utans and breakfast cereals and fruit bats and... BROTHER MAYNARD: Skip a bit brother ... "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@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 ///