mirror of
https://github.com/vim/vim.git
synced 2025-10-07 05:54:16 -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:
@@ -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);
|
||||||
|
@@ -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
|
||||||
|
|
||||||
|
@@ -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,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user