diff src/indent.c @ 28860:3942ea75b4c0 v8.2.4953

patch 8.2.4953: with 'si' inserting '}' after completion goes wrong Commit: https://github.com/vim/vim/commit/2e444bbef0f36535bf941f007f2961f3f66bbe87 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 14 12:54:23 2022 +0100 patch 8.2.4953: with 'si' inserting '}' after completion goes wrong Problem: With 'smartindent' inserting '}' after completion goes wrong. Solution: Check the cursor is in indent. (closes https://github.com/vim/vim/issues/10420)
author Bram Moolenaar <Bram@vim.org>
date Sat, 14 May 2022 14:00:03 +0200
parents 948877671c54
children 6cdf55afaae9
line wrap: on
line diff
--- a/src/indent.c
+++ b/src/indent.c
@@ -1197,7 +1197,8 @@ ins_try_si(int c)
     int		temp;
 
     // do some very smart indenting when entering '{' or '}'
-    if (((did_si || can_si_back) && c == '{') || (can_si && c == '}'))
+    if (((did_si || can_si_back) && c == '{')
+	    || (can_si && c == '}' && inindent(0)))
     {
 	// for '}' set indent equal to indent of line containing matching '{'
 	if (c == '}' && (pos = findmatch(NULL, '{')) != NULL)