0
0
mirror of https://github.com/vim/vim.git synced 2025-10-08 06:04:08 -04:00

patch 8.2.2166: auto format doesn't work when deleting text

Problem:    Auto format doesn't work when deleting text.
Solution:   Make "x" trigger auto format. (closes #7504)
This commit is contained in:
Bram Moolenaar
2020-12-20 13:07:48 +01:00
parent 8f22f5c3aa
commit d0a1dee3f1
3 changed files with 15 additions and 0 deletions

View File

@@ -938,6 +938,7 @@ op_delete(oparg_T *oap)
curwin->w_cursor = curpos; // restore curwin->w_cursor curwin->w_cursor = curpos; // restore curwin->w_cursor
(void)do_join(2, FALSE, FALSE, FALSE, FALSE); (void)do_join(2, FALSE, FALSE, FALSE, FALSE);
} }
auto_format(FALSE, TRUE);
} }
msgmore(curbuf->b_ml.ml_line_count - old_lcount); msgmore(curbuf->b_ml.ml_line_count - old_lcount);

View File

@@ -934,6 +934,18 @@ func Test_fo_a_w()
call assert_equal('g uu uu ', getline(1)[-8:]) call assert_equal('g uu uu ', getline(1)[-8:])
call assert_equal(['uu. foo'], getline(2, '$')) 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! %bw!
endfunc endfunc

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2166,
/**/ /**/
2165, 2165,
/**/ /**/