patch 8.2.3787: no proper formatting of a C line comment after a statement

Problem:    No proper formatting of a C line comment after a statement.
Solution:   Find the start of the line comment, insert the comment leader and
            indent the comment properly.
diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim
index c097ca7..c7ce2ba 100644
--- a/src/testdir/test_cindent.vim
+++ b/src/testdir/test_cindent.vim
@@ -1694,9 +1694,9 @@
   #endif
 
   int y;		// comment
-  // comment
+			// comment
 
-  // comment
+			// comment
 
   {
   	Constructor(int a,
diff --git a/src/testdir/test_textformat.vim b/src/testdir/test_textformat.vim
index 2b76292..62cefa1 100644
--- a/src/testdir/test_textformat.vim
+++ b/src/testdir/test_textformat.vim
@@ -196,6 +196,36 @@
   enew!
 endfunc
 
+func Test_format_c_comment()
+  new
+  setl ai cindent tw=40 et fo=croql
+  let text =<< trim END
+      var = 2345;  // asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf
+  END
+  call setline(1, text)
+  normal gql
+  let expected =<< trim END
+      var = 2345;  // asdf asdf asdf asdf asdf
+                   // asdf asdf asdf asdf asdf
+  END
+  call assert_equal(expected, getline(1, '$'))
+
+  %del
+  let text =<< trim END
+      var = 2345;  // asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf
+  END
+  call setline(1, text)
+  normal gql
+  let expected =<< trim END
+      var = 2345;  // asdf asdf asdf asdf asdf
+                   // asdf asdf asdf asdf asdf
+                   // asdf asdf
+  END
+  call assert_equal(expected, getline(1, '$'))
+
+  bwipe!
+endfunc
+
 " Tests for :right, :center and :left on text with embedded TAB.
 func Test_format_align()
   enew!