changeset 27599:044a12908236 v8.2.4326

patch 8.2.4326: "o" and "O" copying comment not sufficiently tested Commit: https://github.com/vim/vim/commit/51ab7c7d0da08aac796acff22a6c075dac579e76 Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Feb 8 12:58:37 2022 +0000 patch 8.2.4326: "o" and "O" copying comment not sufficiently tested Problem: "o" and "O" copying comment not sufficiently tested. Solution: Add a test case. (closes https://github.com/vim/vim/issues/9718)
author Bram Moolenaar <Bram@vim.org>
date Tue, 08 Feb 2022 14:00:04 +0100
parents 265ca21ac8a4
children 6e3d83368cdb
files src/testdir/test_textformat.vim src/version.c
diffstat 2 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_textformat.vim
+++ b/src/testdir/test_textformat.vim
@@ -238,7 +238,33 @@ func Test_format_c_comment()
   END
   call assert_equal(expected, getline(1, '$'))
 
-  " Using "o" repeats the line comment, "O" does not.
+  " Using either "o" or "O" repeats a line comment occupying a whole line.
+  %del
+  let text =<< trim END
+      nop;
+      // This is a comment
+      val = val;
+  END
+  call setline(1, text)
+  normal 2Go
+  let expected =<< trim END
+      nop;
+      // This is a comment
+      //
+      val = val;
+  END
+  call assert_equal(expected, getline(1, '$'))
+  normal 2GO
+  let expected =<< trim END
+      nop;
+      //
+      // This is a comment
+      //
+      val = val;
+  END
+  call assert_equal(expected, getline(1, '$'))
+
+  " Using "o" repeats a line comment after a statement, "O" does not.
   %del
   let text =<< trim END
       nop;
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4326,
+/**/
     4325,
 /**/
     4324,