patch 8.1.0671: cursor in the wrong column after auto-formatting
Problem: Cursor in the wrong column after auto-formatting.
Solution: Check for deleting more spaces than adding. (closes #3748)
diff --git a/src/testdir/test_textformat.vim b/src/testdir/test_textformat.vim
index 377f761..0f8e095 100644
--- a/src/testdir/test_textformat.vim
+++ b/src/testdir/test_textformat.vim
@@ -450,5 +450,16 @@
\ ], getline(1, '$'))
unmap gg
+ set tw&
enew!
endfunc
+
+func Test_format_list_auto()
+ new
+ call setline(1, ['1. abc', '2. def', '3. ghi'])
+ set fo=tan ai bs=2
+ call feedkeys("3G0lli\<BS>\<BS>x\<Esc>", 'tx')
+ call assert_equal('2. defx ghi', getline(2))
+ bwipe!
+ set fo& ai& bs&
+endfunc