bobbylight / RSyntaxTextArea

A syntax highlighting, code folding text editor for Java Swing applications.
BSD 3-Clause "New" or "Revised" License
1.12k stars 259 forks source link

Behaviour of ToggleCommentAction #570

Open sesquialtera87 opened 2 months ago

sesquialtera87 commented 2 months ago

Description ToggleCommentAction seems to act only at line start. For example, if RSyntaxTextArea contains the following Java code I try to de-comment the second line:

private void add(int a, int b) {
    // return 2*a + b
    return a + b;
}

I get this, where another double-slash line comment is inserted, instead of beeing removed.

private void add(int a, int b) {
//    // return 2*a + b
    return a + b;
}

Expected behavior It would seem appropriate for ToggleCommentAction to identify a comment regardless of the leading whitespaces preceding the comment marker.

Java version OpenJDK 18.0.2