summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-10-15 10:49:36 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-15 10:49:36 +0100
commita79b35b5781ae770334cec781d17fec3875f8108 (patch)
tree7880c30158c21d03871822c8961b268d1ec07656
parentb77bdce120d7e140d0d0bd535ec9febdef78993d (diff)
patch 9.0.0754: 'indentexpr' overrules lisp indenting in one situationv9.0.0754
Problem: 'indentexpr' overrules lisp indenting in one situation. Solution: Add "else" to keep the lisp indent. (issue #11327)
-rw-r--r--src/change.c7
-rw-r--r--src/testdir/test_lispindent.vim11
-rw-r--r--src/version.c2
3 files changed, 16 insertions, 4 deletions
diff --git a/src/change.c b/src/change.c
index 84afcc7338..c409acdadd 100644
--- a/src/change.c
+++ b/src/change.c
@@ -2269,19 +2269,18 @@ open_line(
else
vreplace_mode = 0;
- // May do lisp indenting.
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();
}
-
- // May do indenting after opening a new line.
- if (do_cindent)
+ else if (do_cindent)
{
+ // do 'cindent' or 'indentexpr' indenting
do_c_expr_indent();
ai_col = (colnr_T)getwhitecols_curline();
}
diff --git a/src/testdir/test_lispindent.vim b/src/testdir/test_lispindent.vim
index 8f2d3324b2..3c8660e0ab 100644
--- a/src/testdir/test_lispindent.vim
+++ b/src/testdir/test_lispindent.vim
@@ -91,6 +91,17 @@ func Test_lispindent_negative()
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
diff --git a/src/version.c b/src/version.c
index 3bb2a2f990..90fff9a0fa 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 754,
+/**/
753,
/**/
752,