Skip to content

Commit

Permalink
Merge branch 'ToggleCommentAction-fix' into ToggleCommentAction-white…
Browse files Browse the repository at this point in the history
…space-fix

# Conflicts:
#	RSyntaxTextArea/src/test/java/org/fife/ui/rsyntaxtextarea/RSyntaxTextAreaEditorKitToggleCommentActionTest.java
  • Loading branch information
sesquialtera87 committed Nov 15, 2024
2 parents 6fb13ea + 38d12c4 commit fa84d30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2213,15 +2213,15 @@ public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
return;
}

RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
RSyntaxDocument doc = (RSyntaxDocument) textArea.getDocument();
Element map = doc.getDefaultRootElement();
Caret c = textArea.getCaret();
int dot = c.getDot();
int mark = c.getMark();
int line1 = map.getElementIndex(dot);
int line2 = map.getElementIndex(mark);
int start = Math.min(line1, line2);
int end = Math.max(line1, line2);
int end = Math.max(line1, line2);

Token t = doc.getTokenListForLine(start);
int languageIndex = t != null ? t.getLanguageIndex() : 0;
Expand All @@ -2234,7 +2234,7 @@ public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {

// Don't toggle comment on last line if there is no
// text selected on it.
if (start!=end) {
if (start != end) {
Element elem = map.getElement(end);
if (Math.max(dot, mark) == elem.getStartOffset()) {
end--;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,4 @@ void startEndSearch() {
Assertions.assertEquals(-1, action.endMatch(" // text", markers));
Assertions.assertEquals(-1, action.endMatch("", markers));
}
}
}

0 comments on commit fa84d30

Please sign in to comment.