aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/ops.c5
-rw-r--r--src/nvim/testdir/test_textformat.vim7
2 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index a0dee7ace8..7dd06423cb 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -1725,7 +1725,9 @@ int op_delete(oparg_T *oap)
(int)oap->line_count-1, n, deleted_bytes,
0, 0, 0, kExtmarkUndo);
}
- auto_format(false, true);
+ if (oap->op_type == OP_DELETE) {
+ auto_format(false, true);
+ }
}
msgmore(curbuf->b_ml.ml_line_count - old_lcount);
@@ -2486,6 +2488,7 @@ int op_change(oparg_T *oap)
xfree(ins_text);
}
}
+ auto_format(false, true);
return retval;
}
diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim
index 29f0433954..bf0706a0c2 100644
--- a/src/nvim/testdir/test_textformat.vim
+++ b/src/nvim/testdir/test_textformat.vim
@@ -975,6 +975,13 @@ func Test_fo_a_w()
exe "normal f4xx"
call assert_equal(['1 2 5 6 7 ', '8 9'], getline(1, 2))
+ " using "cw" leaves cursor in right spot
+ call setline(1, ['Now we g whether that nation, or',
+ \ 'any nation so conceived and,'])
+ set fo=tcqa tw=35
+ exe "normal 2G0cwx\<Esc>"
+ call assert_equal(['Now we g whether that nation, or x', 'nation so conceived and,'], getline(1, 2))
+
set tw=0
set fo&
%bw!