mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
vim-patch:9.0.0754: 'indentexpr' overrules lisp indenting in one situation
Problem: 'indentexpr' overrules lisp indenting in one situation.
Solution: Add "else" to keep the lisp indent. (issue vim/vim#11327)
a79b35b578
This commit is contained in:
@@ -1814,17 +1814,15 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
|
|||||||
vreplace_mode = 0;
|
vreplace_mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// May do lisp indenting.
|
|
||||||
if (!p_paste
|
if (!p_paste
|
||||||
&& leader == NULL
|
&& leader == NULL
|
||||||
&& curbuf->b_p_lisp
|
&& curbuf->b_p_lisp
|
||||||
&& curbuf->b_p_ai) {
|
&& curbuf->b_p_ai) {
|
||||||
|
// do lisp indenting
|
||||||
fixthisline(get_lisp_indent);
|
fixthisline(get_lisp_indent);
|
||||||
ai_col = (colnr_T)getwhitecols_curline();
|
ai_col = (colnr_T)getwhitecols_curline();
|
||||||
}
|
} else if (do_cindent) {
|
||||||
|
// do 'cindent' or 'indentexpr' indenting
|
||||||
// May do indenting after opening a new line.
|
|
||||||
if (do_cindent) {
|
|
||||||
do_c_expr_indent();
|
do_c_expr_indent();
|
||||||
ai_col = (colnr_T)getwhitecols_curline();
|
ai_col = (colnr_T)getwhitecols_curline();
|
||||||
}
|
}
|
||||||
|
@@ -91,6 +91,17 @@ func Test_lispindent_negative()
|
|||||||
call assert_equal(-1, lispindent(-1))
|
call assert_equal(-1, lispindent(-1))
|
||||||
endfunc
|
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()
|
func Test_lisp_indent_works()
|
||||||
" This was reading beyond the end of the line
|
" This was reading beyond the end of the line
|
||||||
new
|
new
|
||||||
|
Reference in New Issue
Block a user