Skip to content

Commit

Permalink
Fix formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sesquialtera87 committed Nov 15, 2024
1 parent 904e07c commit 6fb13ea
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2207,20 +2207,21 @@ public ToggleCommentAction() {

@Override
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {

if (!textArea.isEditable() || !textArea.isEnabled()) {
UIManager.getLookAndFeel().provideErrorFeedback(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 @@ -2231,8 +2232,9 @@ public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
return;
}

/* Don't toggle comment on last line if there is no text selected on it. */
if (start != end) {
// Don't toggle comment on last line if there is no
// text selected on it.
if (start!=end) {
Element elem = map.getElement(end);
if (Math.max(dot, mark) == elem.getStartOffset()) {
end--;
Expand Down Expand Up @@ -2393,4 +2395,4 @@ public final String getMacroID() {
}


}
}

0 comments on commit 6fb13ea

Please sign in to comment.