]> granicus.if.org Git - vim/commitdiff
patch 8.2.4710: smart indenting does not work after completion v8.2.4710
authorChristian Brabandt <cb@256bit.org>
Thu, 7 Apr 2022 20:00:53 +0000 (21:00 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 7 Apr 2022 20:00:53 +0000 (21:00 +0100)
Problem:    Smart indenting does not work after completion.
Solution:   Set "can_si". (Christian Brabandt, closes #10113, closes #558)

src/edit.c
src/testdir/test_ins_complete.vim
src/version.c

index 53e86ff18f268228a28332fb541c3146dacdc35c..f30edd5c790cb63170e6ebe29caa5dea0d6ca48b 100644 (file)
@@ -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
index 3712abe69085e9c8bd189a9caf69782e5a12b926..75ec03cb370e4fabb9364aae0a0c5ebfc55731a7 100644 (file)
@@ -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
index 7eec582d98ef9d10053ecbe0c5bea4f76fe8d4af..956100304bd9e2724429dc716d46f284407bb37e 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4710,
 /**/
     4709,
 /**/