patch 9.2.0345: Wrong autoformatting with 'autocomplete'
Commit:
https://github.com/vim/vim/commit/efbd482116d0f1a244b436a46ce3544b016de04b
Author: zeertzjq <[email protected]>
Date: Tue Apr 14 16:48:55 2026 +0000
patch 9.2.0345: Wrong autoformatting with 'autocomplete'
Problem: Wrong autoformatting with 'autocomplete'.
Solution: Don't trigger autoformatting when ending autocompletion
without selecting an item (zeertzjq).
fixes: #19954
closes: #19970
Signed-off-by: zeertzjq <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/insexpand.c b/src/insexpand.c
index 3fade6cb1..abdcafa7b 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -2956,7 +2956,7 @@ ins_compl_stop(int c, int prev_mode, int retval)
want_cindent = FALSE; // don't do it again
}
}
- else
+ else if (!compl_autocomplete || compl_used_match)
{
int prev_col = curwin->w_cursor.col;
diff --git a/src/testdir/test_ins_complete.vim
b/src/testdir/test_ins_complete.vim
index bf16a9361..a32bc45cc 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -6289,4 +6289,20 @@ func Test_ins_register_preinsert_autocomplete()
delfunc TestOmni
endfunc
+func Test_autocomplete_with_auto_format()
+ call test_override("char_avail", 1)
+ new
+ setlocal formatoptions=tcq textwidth=9 autocomplete noautoindent
+ call feedkeys("ia b c d\<Esc>ie f g\<Esc>", 'tx')
+ call assert_equal(['a b c e f', 'gd'], getline(1, '$'))
+
+ %delete
+ setlocal autoindent
+ call feedkeys("ia b c d\<Esc>ie f g\<Esc>", 'tx')
+ call assert_equal(['a b c e f', 'gd'], getline(1, '$'))
+
+ bw!
+ call test_override("char_avail", 0)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
diff --git a/src/version.c b/src/version.c
index 169404511..f9899cb4f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 345,
/**/
344,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1wCh7M-002XzQ-JG%40256bit.org.