Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Block uncomment triggered by Toggle Line Comment doesn't work for some selections #2339

Closed
peterflynn opened this issue Dec 12, 2012 · 2 comments

Comments

@peterflynn
Copy link
Member

Consider this code:

/*span.foo {
    color: gray;
}*/

Try Toggle Line Comment with the following different selections:

  1. Select exactly from the first '/' through to the 2nd '/' (inclusive)
  2. Select from the first '/' to the middle of 'color'
  3. Select from the middle of 'color' through the 2nd '/'
  4. Select all 3 lines entirely (i.e. including the trailing newline, so the selection endpoint is technically char 0 of the 4th line)

Result:

  1. Block comment removed
  2. Block comment removed
  3. Code unchanged, but selection shifts down a line
  4. Nothing at all happens

Expected:
Seems like 3 & 4 should also remove the block comment. In 1 & 3 the selection endpoint is exactly the same; and users will likely view 1 & 4 as equivalent selections.

@TomMalbran
Copy link
Contributor

3 should keep the selection how it was before.

4 seems to fail only if that is the last comment of the document. It works if there is more content after it. It seems to be a bug in the block comment and not line comment. Not sure why is that happening.

@peterflynn
Copy link
Member Author

Fix verified. Wrote some unit tests for this too -- see pull #2362.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants