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

Fix #570 - Behaviour of ToggleCommentAction #572

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

sesquialtera87
Copy link

I tried to solve the comment-mark identification by ToggleCommentAction.
Basically, the use of startsWith and endsWith methods allowed only to search for comment-marks at position 0 and line.length()-1, not recognizing in this way comments like

_______<!-- underscores are whitespaces -->_______

where some whitespaces are present before or after the marks.

Instead of the startsWith and endsWith, I introduced two methods looking for mark by skipping leading or trailing whitespaces. Now de-comment a code like this work as expected (previously another comment would have been inserted)

   <tag>
      <!-- <b>text</b> -->
   </tag>
   <tag>
       <b>text</b> 
   </tag>

I hope it can be useful

…ix' into ToggleCommentAction-whitespace-fix

# Conflicts:
#	RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/RSyntaxTextAreaEditorKit.java
#	RSyntaxTextArea/src/test/java/org/fife/ui/rsyntaxtextarea/RSyntaxTextAreaEditorKitToggleCommentActionTest.java
@bobbylight
Copy link
Owner

@sesquialtera87 can you rebase and fix the merge conflicts here? I'd be interested in adding this fix to the next release.

# Conflicts:
#	RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/RSyntaxTextAreaEditorKit.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants