Ticket #4565 (new defect)

Opened 6 weeks ago

Last modified 6 weeks ago

Regression(s) in syntax highlighting of multi-line C directives

Reported by: purdeaandrei Owned by:
Priority: major Milestone: Future Releases
Component: mcedit Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

The following changeset:
changeset:49493dc8e006d4e6c6298aedfc39e4c1a9dd74bb
Fixes ticket:
ticket:3487

However it introduces a regression, the following code doesn't get correctly highlighted anymore:

#define MULTILINE_MACRO \
         (definition_continued here)

The feature that was disabled was explicitly supported by mcedit manual page:

       Important to note is the line

         keyword  \\\n  brightgreen

       This line defines a keyword containing the backslash and newline charac‐
       ters.   Since  the  keywords  are matched before the context delimiters,
       this keyword prevents the context from ending at the end  of  the  lines
       that  end in a backslash, thus allowing C preprocessor directive to con‐
       tinue across multiple lines.

Since in this case C requires both single line comment keywords and backslashes for multi-line macros to end at the end of the line

Also, a less important change I noticed regarding this, is in later changeset:cd8355bfa8b22706cd09f144b0a67a1de3d50b9b

It makes _preproc_nl_esc red instead of yellow. Nor necessarily a big issue, but this feels like an unintended change, because the above mentioned bug was in place, so multi-line pre-processor directives probably weren't tested, or this would have been noticed.

On an only slightly-related note: preprocessor directives that don't start on the first column of a line are (and have always been) handled with a keyword (see _preproc_indent). There's no reason to color them differently, but as far as I can tell it's not possible to consume the whitespace after linestart? So I guess it would be nice to also have a "linestart-whitespace" keyword that would do it for us, or make it possible to specify the whitespace in "delim" like in keywords with \{\s\t\}\[\s\t\]#

Change History

comment:1 Changed 6 weeks ago by andrew_b

  • Component changed from mc-core to mcedit
Note: See TracTickets for help on using tickets.