Patch 9.0.0754
Problem: 'indentexpr' overrules lisp indenting in one situation.
Solution: Add "else" to keep the lisp indent. (issue #11327)
Files: src/change.c, src/testdir/test_lispindent.vim
*** ../vim-9.0.0753/src/change.c 2022-10-05 13:28:53.957039865 +0100
--- src/change.c 2022-10-15 10:48:40.709088632 +0100
***************
*** 2269,2287 ****
else
vreplace_mode = 0;
- // May do lisp indenting.
if (!p_paste
&& leader == NULL
&& curbuf->b_p_lisp
&& curbuf->b_p_ai)
{
fixthisline(get_lisp_indent);
ai_col = (colnr_T)getwhitecols_curline();
}
!
! // May do indenting after opening a new line.
! if (do_cindent)
{
do_c_expr_indent();
ai_col = (colnr_T)getwhitecols_curline();
}
--- 2269,2286 ----
else
vreplace_mode = 0;
if (!p_paste
&& leader == NULL
&& curbuf->b_p_lisp
&& curbuf->b_p_ai)
{
+ // do lisp indenting
fixthisline(get_lisp_indent);
ai_col = (colnr_T)getwhitecols_curline();
}
! else if (do_cindent)
{
+ // do 'cindent' or 'indentexpr' indenting
do_c_expr_indent();
ai_col = (colnr_T)getwhitecols_curline();
}
*** ../vim-9.0.0753/src/testdir/test_lispindent.vim 2022-10-13 12:29:34.233533860 +0100
--- src/testdir/test_lispindent.vim 2022-10-15 10:46:10.212453333 +0100
***************
*** 91,96 ****
--- 91,107 ----
call assert_equal(-1, lispindent(-1))
endfunc
+ func Test_lispindent_with_indentexpr()
+ enew
+ setl ai lisp nocin indentexpr=11
+ exe "normal a(x\<CR>1\<CR>2)\<Esc>"
+ let expected = ['(x', ' 1', ' 2)']
+ call assert_equal(expected, getline(1, 3))
+ normal 1G=G
+ call assert_equal(expected, getline(1, 3))
+ bwipe!
+ endfunc
+
func Test_lisp_indent_works()
" This was reading beyond the end of the line
new
*** ../vim-9.0.0753/src/version.c 2022-10-15 10:21:33.330116472 +0100
--- src/version.c 2022-10-15 10:47:47.468878558 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 754,
/**/
--
An indication you must be a manager:
You give constructive feedback to your dog.
/// Bram Moolenaar -- Br...@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 ///