Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCaml: toggle_comment doesn't enclose text #2873

Closed
tuohy opened this issue Jun 25, 2022 · 2 comments
Closed

OCaml: toggle_comment doesn't enclose text #2873

tuohy opened this issue Jun 25, 2022 · 2 comments
Labels
C-bug Category: This is a bug R-duplicate Duplicated issue: please refer to the linked issue

Comments

@tuohy
Copy link

tuohy commented Jun 25, 2022

Summary

Using toggle_comment (ctrl-c) adds an empty comment to the beginning of the line your cursor is on / the beginning of each line you have selected, leaving the line /selection outside of the comment.

Reproduction Steps

asciinema demonstration:
https://asciinema.org/a/s8wHb2tHswrfjFZxWhFRaE2gw

I tried this:

  1. Open a .ml file in helix
  2. (Optional) select multiple characters or lines
  3. Press ctrl-c to invoke toggle_comment

I expected this to happen:
When no selection is made, the whole line should be wrapped inside a comment:
| 0 -> 1 should become (* | 0 -> 1 *)
If a selection is made, it should be transformed into a multi line comment inside a (* *) pair:

let () = let a = f 1 in
  print_endline (string_of_int a)

should become:

(*
let () = let a = f 1 in
  print_endline (string_of_int a)
*)

Instead, this happened:
The line or lines have an empty comment (**) added at the start of the line, i.e. the latter example above becomes

(**) let () = let a = f 1 in
(**)   print_endline (string_of_int a)

Helix log

~/.cache/helix/helix.log

helix.log

Platform

Linux

Terminal Emulator

st, alacritty

Helix Version

22.05-128-gc107f4ea

@tuohy tuohy added the C-bug Category: This is a bug label Jun 25, 2022
@the-mikedavis
Copy link
Member

Duplicate of #2770

@the-mikedavis the-mikedavis marked this as a duplicate of #2770 Jun 25, 2022
@the-mikedavis the-mikedavis added the R-duplicate Duplicated issue: please refer to the linked issue label Jun 25, 2022
@the-mikedavis
Copy link
Member

Block comments in general need to be addressed to fix this: #1505

It's particularly noticeable for languages like OCaml that don't have line comments at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug R-duplicate Duplicated issue: please refer to the linked issue
Projects
None yet
Development

No branches or pull requests

2 participants