patch 9.1.1240: Regression with ic/ac text objects and comment plugin

Problem:  Regression with ic/ac text objects and comment plugin
Solution: Fix regression, update tests (Maxim Kim)

fix regression: sometimes ic/ac should be line-wise

```
int main() {
    // multilple comments
    // cursor is between them
}

 # dac ->

int main() {
}
```

closes: #16947
closes: #16980

Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_plugin_comment.vim b/src/testdir/test_plugin_comment.vim
index a0425d5..b1d356b 100644
--- a/src/testdir/test_plugin_comment.vim
+++ b/src/testdir/test_plugin_comment.vim
@@ -457,7 +457,7 @@
 
   let result = readfile(output_file)
 
-  call assert_equal(["int main() {", "", "}"], result)
+  call assert_equal(["int main() {", "}"], result)
 endfunc
 
 func Test_textobj_conseq_comment()
@@ -514,3 +514,49 @@
 
   call assert_equal(["int main() {", "    printf(\"hello\");", "", "    // world", "    printf(\"world\");", "}"], result)
 endfunc
+
+func Test_inline_comment()
+  CheckScreendump
+  let lines =<< trim END
+    echo "Hello" This should be a comment
+  END
+
+  let input_file = "test_inline_comment_input.vim"
+  call writefile(lines, input_file, "D")
+
+  let buf = RunVimInTerminal('-c "packadd comment" -c "nnoremap <expr> gC comment#Toggle()..''$''" ' .. input_file, {})
+
+  call term_sendkeys(buf, "fTgC")
+
+  let output_file = "comment_inline_test.vim"
+  call term_sendkeys(buf, $":w {output_file}\<CR>")
+  defer delete(output_file)
+
+  call StopVimInTerminal(buf)
+
+  let result = readfile(output_file)
+  call assert_equal(['echo "Hello" " This should be a comment'], result)
+endfunc
+
+func Test_inline_uncomment()
+  CheckScreendump
+  let lines =<< trim END
+    echo "Hello" " This should be a comment
+  END
+
+  let input_file = "test_inline_uncomment_input.vim"
+  call writefile(lines, input_file, "D")
+
+  let buf = RunVimInTerminal('-c "packadd comment" -c "nnoremap <expr> gC comment#Toggle()..''$''" ' .. input_file, {})
+
+  call term_sendkeys(buf, '$F"gC')
+
+  let output_file = "uncomment_inline_test.vim"
+  call term_sendkeys(buf, $":w {output_file}\<CR>")
+  defer delete(output_file)
+
+  call StopVimInTerminal(buf)
+
+  let result = readfile(output_file)
+  call assert_equal(['echo "Hello" This should be a comment'], result)
+endfunc
diff --git a/src/version.c b/src/version.c
index dcb428e..9ada5e0 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1240,
+/**/
     1239,
 /**/
     1238,