diff options
-rw-r--r-- | src/nvim/edit.c | 4 | ||||
-rw-r--r-- | src/nvim/ops.c | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_textformat.vim | 12 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 1cf821f786..45bd84261d 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3716,7 +3716,7 @@ static bool ins_compl_prep(int c) retval = true; } - auto_format(FALSE, TRUE); + auto_format(false, true); // Trigger the CompleteDonePre event to give scripts a chance to // act upon the completion before clearing the info, and restore @@ -6503,7 +6503,7 @@ stop_insert ( curwin->w_cursor = tpos; } - auto_format(TRUE, FALSE); + auto_format(true, false); if (ascii_iswhite(cc)) { if (gchar_cursor() != NUL) diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 40dd5f0b5c..37db1bb7e2 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1683,6 +1683,7 @@ int op_delete(oparg_T *oap) (int)oap->line_count-1, n, deleted_bytes, 0, 0, 0, kExtmarkUndo); } + auto_format(false, true); } msgmore(curbuf->b_ml.ml_line_count - old_lcount); diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim index 64b873c3c3..4af52b536c 100644 --- a/src/nvim/testdir/test_textformat.vim +++ b/src/nvim/testdir/test_textformat.vim @@ -957,6 +957,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 |