changeset 28369:38332c6da029 v8.2.4710

patch 8.2.4710: smart indenting does not work after completion Commit: https://github.com/vim/vim/commit/ac72c21da696cf6c31630a9e5ff4c0d3e2049c11 Author: Christian Brabandt <cb@256bit.org> Date: Thu Apr 7 21:00:53 2022 +0100 patch 8.2.4710: smart indenting does not work after completion Problem: Smart indenting does not work after completion. Solution: Set "can_si". (Christian Brabandt, closes https://github.com/vim/vim/issues/10113, closes https://github.com/vim/vim/issues/558)
author Bram Moolenaar <Bram@vim.org>
date Thu, 07 Apr 2022 22:15:03 +0200
parents 04fcfcacf321
children 953e5ee8ce51
files src/edit.c src/testdir/test_ins_complete.vim src/version.c
diffstat 3 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/edit.c
+++ b/src/edit.c
@@ -1293,6 +1293,9 @@ docomplete:
 	    disable_fold_update--;
 #endif
 	    compl_busy = FALSE;
+#ifdef FEAT_SMARTINDENT
+	    can_si = TRUE; // allow smartindenting
+#endif
 	    break;
 
 	case Ctrl_Y:	// copy from previous line or scroll down
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -2132,4 +2132,23 @@ func Test_thesaurusfunc_callback()
   %bw!
 endfunc
 
+func FooBarComplete(findstart, base)
+  if a:findstart
+    return col('.') - 1
+  else
+    return ["Foo", "Bar", "}"]
+  endif
+endfunc
+
+func Test_complete_smartindent()
+  new
+  setlocal smartindent completefunc=FooBarComplete
+
+  exe "norm! o{\<cr>\<c-x>\<c-u>\<c-p>}\<cr>\<esc>"
+  let result = getline(1,'$')
+  call assert_equal(['', '{','}',''], result)
+  bw!
+  delfunction! FooBarComplete
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4710,
+/**/
     4709,
 /**/
     4708,