To: vim_dev@googlegroups.com Subject: Patch 8.2.4737 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4737 Problem: // in JavaScript string recognized as comment. Solution: Only check for linecomment if 'cindent' is set. (closes #10151) Files: src/change.c, src/testdir/test_textformat.vim *** ../vim-8.2.4736/src/change.c 2022-04-07 15:07:42.680524339 +0100 --- src/change.c 2022-04-11 17:33:33.620807957 +0100 *************** *** 1659,1665 **** lead_len = get_leader_len(saved_line, &lead_flags, dir == BACKWARD, TRUE); #ifdef FEAT_CINDENT ! if (lead_len == 0 && do_cindent && dir == FORWARD) { // Check for a line comment after code. comment_start = check_linecomment(saved_line); --- 1659,1665 ---- lead_len = get_leader_len(saved_line, &lead_flags, dir == BACKWARD, TRUE); #ifdef FEAT_CINDENT ! if (lead_len == 0 && curbuf->b_p_cin && do_cindent && dir == FORWARD) { // Check for a line comment after code. comment_start = check_linecomment(saved_line); *** ../vim-8.2.4736/src/testdir/test_textformat.vim 2022-02-08 12:58:32.416043337 +0000 --- src/testdir/test_textformat.vim 2022-04-11 17:33:05.148887174 +0100 *************** *** 278,289 **** // END call assert_equal(expected, getline(1, '$')) normal 2GO let expected =<< trim END nop; val = val; // This is a comment - // END call assert_equal(expected, getline(1, '$')) --- 278,302 ---- // END call assert_equal(expected, getline(1, '$')) + + " using 'indentexpr' instead of 'cindent' does not repeat a comment + setl nocindent indentexpr=2 + 3delete + normal 2Gox + let expected =<< trim END + nop; + val = val; // This is a comment + x + END + call assert_equal(expected, getline(1, '$')) + setl cindent indentexpr= + 3delete + normal 2GO let expected =<< trim END nop; val = val; // This is a comment END call assert_equal(expected, getline(1, '$')) *** ../vim-8.2.4736/src/version.c 2022-04-11 15:28:45.824940910 +0100 --- src/version.c 2022-04-11 17:35:02.760573025 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4737, /**/ -- BLACK KNIGHT: I'm invincible! ARTHUR: You're a looney. "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/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///