GNU nano - Bugs: bug #64340, the C syntax colorizes a URL in a...
You are not allowed to post comments on this tracker with your current authentication level.
bug #64340: the C syntax colorizes a URL in a string as a comment
Submitter: | Yonut Smith <yonut> | ||
Submitted: | Fri 23 Jun 2023 02:49:34 PM UTC | ||
Severity: | 2 - Minor | Status: | Fixed |
Assigned to: | bens | Open/Closed: | Open |
Jump to the original submission
Tue 09 Jan 2024 09:27:24 AM UTC, comment #8: |
Benno Schulenberg <bens> |
Mon 08 Jan 2024 01:04:19 PM UTC, comment #7: Seems like a good compromise to me :) |
Tasos Papastylianou <tpapastylianou> |
Mon 08 Jan 2024 10:35:09 AM UTC, comment #6: Putting the coloring rule for single-line comments before the rule for strings has at least two effects: 1) Characters after the closing quote of a string that contains a double slash still get colored as a comment; and 2) quoted things in line comments get colorized bright yellow as if they were super important. Both these things are not nice. So I don't want to change the order of the coloring rules.
This shows that a URL in a string is relatively common, so it would be nice not to miscolorize such a string.
This allows a line comment to follow directly after other characters as long as the comment does not contain a doubele quote -- if it does, then the // needs to be preceded by a blank (or be at the start of the line).
|
Benno Schulenberg <bens> |
Thu 04 Jan 2024 04:18:17 PM UTC, comment #5: Happy New Year, Tasos. :)
|
Benno Schulenberg <bens> |
Thu 04 Jan 2024 02:31:44 AM UTC, comment #4: (My apologies ... I'm bored and perusing the nano bug tracker, as one does ... Happy New Year Benno!)
|
Tasos Papastylianou <tpapastylianou> |
Wed 28 Jun 2023 06:27:39 AM UTC, comment #3: With this regex:
the character before the double slash will be colored too. When it's whitespace, there's no problem, because in this whitespace there's nothing to color (except when switching on visible whitespace). But when there's text right before the //, then its last character will be colored. For example, in the line "foobar//comment", "r//comment" will be colorized as a comment. Not nice.
|
Benno Schulenberg <bens> |
Tue 27 Jun 2023 07:45:45 PM UTC, comment #2: Tyvm for your response. I have used about a day and a half to learn Perl regex (perlre). I can't say I wasted my time, as I was able to come up with a solution that satisfies all cases. The only caveat is if it immediately follows a colon ':'.
|
Yonut Smith <yonut> |
Sun 25 Jun 2023 06:36:10 AM UTC, comment #1: In nano's code, almost all URLs occur inside comments. Just one occurs inside a string, in winio.c -- I never noticed that it is miscolored.
(The '\s' matches not just a space but also a tab.)
|
Benno Schulenberg <bens> |
Fri 23 Jun 2023 02:49:34 PM UTC, original submission:
The current nano package has a highlight file for c programming files that includes highlights for comments:
|
Yonut Smith <yonut> |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
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.
Follow 4 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2024-01-09 | bens | Status | None | Fixed | |
Assigned to | None | bens | |||
2023-06-25 | bens | Severity | 3 - Normal | 2 - Minor | |
Summary | [Wish] Changes to comment entry of c.nanorc | the C syntax colorizes a URL in a string as a comment |
Powered by Savane 3.13-02a9.
Corresponding source code
Fixed in git, commit 7c174a1a, by using the proposed regex.