mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 8.2.4951: smart indenting done when not enabled
Problem: Smart indenting done when not enabled. Solution: Check option values before setting can_si. (closes #10420)
This commit is contained in:
18
src/indent.c
18
src/indent.c
@@ -1168,6 +1168,22 @@ preprocs_left(void)
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_SMARTINDENT
|
||||
/*
|
||||
* Return TRUE if the conditions are OK for smart indenting.
|
||||
*/
|
||||
int
|
||||
may_do_si()
|
||||
{
|
||||
return curbuf->b_p_si
|
||||
# ifdef FEAT_CINDENT
|
||||
&& !curbuf->b_p_cin
|
||||
# endif
|
||||
# ifdef FEAT_EVAL
|
||||
&& *curbuf->b_p_inde == NUL
|
||||
# endif
|
||||
&& !p_paste;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to do some very smart auto-indenting.
|
||||
* Used when inserting a "normal" character.
|
||||
@@ -1235,7 +1251,7 @@ ins_try_si(int c)
|
||||
}
|
||||
|
||||
// set indent of '#' always to 0
|
||||
if (curwin->w_cursor.col > 0 && can_si && c == '#')
|
||||
if (curwin->w_cursor.col > 0 && can_si && c == '#' && inindent(0))
|
||||
{
|
||||
// remember current indent for next line
|
||||
old_indent = get_indent();
|
||||
|
Reference in New Issue
Block a user