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 10 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
@bobbylight
Copy link
Owner

@sesquialtera87 I hate to ask this, but can you remove all the formatting changes? They're making this PR much larger than it should be and obfuscating the actual change.

@sesquialtera87
Copy link
Author

No problem. In the next few days I'll try to restore the formatting and include only the new code, without touching anything else in the code

@sesquialtera87
Copy link
Author

I'm struggling with Git... I removed every formatting stuff except my own relevant changing to the code, but after committing into this branch or merging with other clean branches I still see into the diff the unusefull IDE reformat insertions.

So, I created a new branch with only the relevant changes to ToggleCommentAction and in this new branch everything work. I dont' know if it's possible to associate to this pull request the new branch I've created. If you think so, I can create a new pull request from the new branch and close this.

Lastly, I include the corrections to the errors reported by the last CodeQL/Gradle analysis.
Screenshot 2024-11-20 155410
I think those now are fixed.

@bobbylight
Copy link
Owner

Hi @sesquialtera87 ! A new branch is probably the cleanest way to move forward.

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