summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-12-20 13:07:48 +0100
committerBram Moolenaar <Bram@vim.org>2020-12-20 13:07:48 +0100
commitd0a1dee3f197d41434df4cf0271066b6aeb690fc (patch)
tree94367a53ea0c68ae5fa0e506424f366feaa9b92e
parent8f22f5c3aa0aa96e3843a57f29405625d8514c74 (diff)
downloadvim-git-d0a1dee3f197d41434df4cf0271066b6aeb690fc.tar.gz
patch 8.2.2166: auto format doesn't work when deleting textv8.2.2166
Problem: Auto format doesn't work when deleting text. Solution: Make "x" trigger auto format. (closes #7504)
-rw-r--r--src/ops.c1
-rw-r--r--src/testdir/test_textformat.vim12
-rw-r--r--src/version.c2
3 files changed, 15 insertions, 0 deletions
diff --git a/src/ops.c b/src/ops.c
index b83394e01..743bdd43d 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -938,6 +938,7 @@ op_delete(oparg_T *oap)
curwin->w_cursor = curpos; // restore curwin->w_cursor
(void)do_join(2, FALSE, FALSE, FALSE, FALSE);
}
+ auto_format(FALSE, TRUE);
}
msgmore(curbuf->b_ml.ml_line_count - old_lcount);
diff --git a/src/testdir/test_textformat.vim b/src/testdir/test_textformat.vim
index a91c3da81..eac1c1980 100644
--- a/src/testdir/test_textformat.vim
+++ b/src/testdir/test_textformat.vim
@@ -934,6 +934,18 @@ func Test_fo_a_w()
call assert_equal('g uu uu ', getline(1)[-8:])
call assert_equal(['uu. foo'], getline(2, '$'))
+ " using backspace or "x" triggers reformat
+ call setline(1, ['1 2 3 4 5 ', '6 7 8 9'])
+ set tw=10
+ set fo=taw
+ set bs=indent,eol,start
+ exe "normal 1G4la\<BS>\<BS>\<Esc>"
+ call assert_equal(['1 2 4 5 6 ', '7 8 9'], getline(1, 2))
+ exe "normal f4xx"
+ call assert_equal(['1 2 5 6 7 ', '8 9'], getline(1, 2))
+
+ set tw=0
+ set fo&
%bw!
endfunc
diff --git a/src/version.c b/src/version.c
index fe06be049..ac6fb1265 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2166,
+/**/
2165,
/**/
2164,