bugGNU nano - Bugs: bug #62497, highlight of line comment in C...


You are not allowed to post comments on this tracker with your current authentication level.

bug #62497: highlight of line comment in C goes wrong when followed by a star

Submitter:  Timothy Liu <timothyliuxf>
Submitted:  Sat 21 May 2022 06:19:57 PM UTC
Severity:  3 - Normal Status:  None
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


Sun 22 May 2022 09:29:38 AM UTC, comment #2: 

It could be solved by making this change in syntax/c.nanorc:

-color brightblue start="/\*" end="\*/"
+color brightblue start="(^|[^/])/\*" end="\*/"

However, this will colorize any character directly before the '/*'.  Usually this will not be a problem, but it will look wrong and ugly when you comment out something in the middle of a line and don't precede the commented-out piece with a space or tab.  Which of the two miscolorings is more annoying?

(The problem has become more common in 6.3 because it now also colorizes unterminated start-end regexes, as the NEWS mentioned.)

Benno Schulenberg <bens>
Project Administrator
Sun 22 May 2022 01:33:51 AM UTC, comment #1: 

This problem is rarely in nano-4.8 (but for some specific files, this problem exists, but the code is too long to upload).
But in nano-6.3, this problem is common.

Timothy Liu <timothyliuxf>
Sat 21 May 2022 06:19:57 PM UTC, original submission:  

When I use line comment followed by a '*' character´╝î that is '//*' , the nano editor will recognize '/*' as the beginning of a block comment, making the following codes all hilighted as comment.
For example:

//* blablabla
int main(void) {}

Timothy Liu <timothyliuxf>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by timothyliuxf (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.





    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-05-30 bens SummaryHighlight of line comment of C and C++ goes wrong when followed by a star character, like: //* highlight of line comment in C goes wrong when followed by a star

    Back to the top

    Powered by Savane 3.9