patch 9.1.1293: comment plugin does not handle 'exclusive' selection for comment object

Problem:  comment plugin does not handle 'exclusive' selection for
          comment object (@mawkish)
Solution: handle special case selection='exclusive' for inline comment
          object (Maxim Kim)

fixes: #17023
closes: #17098

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 992a4f1..d4718bc 100644
--- a/src/testdir/test_plugin_comment.vim
+++ b/src/testdir/test_plugin_comment.vim
@@ -677,3 +677,26 @@
   let result = readfile(output_file)
   call assert_equal(['echo "Hello" This should be a comment'], result)
 endfunc
+
+func Test_textobj_selection_exclusive_inline_comment()
+  CheckScreendump
+  let lines =<< trim END
+    print("Hello") # selection exclusive
+  END
+
+  let input_file = "test_selection_exclusive_inline_comment_input.py"
+  call writefile(lines, input_file, "D")
+
+  let buf = RunVimInTerminal('-c "set selection=exclusive" -c "packadd comment" ' .. input_file, {})
+
+  call term_sendkeys(buf, "dac")
+
+  let output_file = "test_selection_exclusive_inline_comment.py"
+  call term_sendkeys(buf, $":w {output_file}\<CR>")
+  defer delete(output_file)
+
+  call StopVimInTerminal(buf)
+
+  let result = readfile(output_file)
+  call assert_equal(['print("Hello")'], result)
+endfunc