bugGNU nano - Bugs: bug #26111, Colour syntax highlighting is...

 
 

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

bug #26111: Colour syntax highlighting is broken for multi-line C comments

Submitter:  Dave Lemonby <dreamlax>
Submitted:  Wed 08 Apr 2009 01:40:07 AM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Jump to the original submission

Fri 13 Jun 2014 08:32:19 PM UTC, comment #6: 

Considering this fixed.

Benno Schulenberg <bens>
Group administrator
Sat 17 May 2014 08:31:57 PM UTC, comment #5: 

A fix for this went into SVN, r4902.  Please test and report back, if you can.

Benno Schulenberg <bens>
Group administrator
Wed 14 May 2014 04:16:42 PM UTC, comment #4: 

This miscolouring only happens when the color command for comments (the one with 'start=' and 'end=') is the last one in the file.  When you add a silly extra one, say 'color red "not any more!"', then the miscolouring no longer occurs.  So, with the current c.nanorc, I don't see this miscolouring any more, because the color command for trailing whitespace comes last.

Benno Schulenberg <bens>
Group administrator
Fri 21 Feb 2014 01:29:03 PM UTC, comment #3: 

Indeed.  Moving the cursor from line 2 to 3 triggers miscolouring of line 3, and moving the cursor from line 4 to 3 restores proper colouring.  Also typing anything extra into line 2 triggers the miscolouring of line 3 -- but then moving the cursor to line 3 restores proper colouring.  Weird.

Also, all this only happens when the last line in c.nanorc (in /usr/share/nano/) is not «color ,green "[[:space:]]+$"».  Extra weird.

You had me confused a bit with this "if-self".  :)  But indeed, commenting out the «else if (md == CBEGINBEFORE)» block in winio.c gets rid of the erroneous colouring.  (Unfortunately it is not the full solution for all multiline miscolourings: I still get them in Python code when that block is commented out.)

Benno Schulenberg <bens>
Group administrator
Mon 17 Feb 2014 01:52:44 AM UTC, comment #2: 

I can still reproduce this on 2.2.6 and 2.3.2.

Put the following six lines into a file with a .c extension:

/* this comment starts on this line
   and ends on this line */
int main(int argc, char *argv[])
{
    return 0;
}


Open this file up in nano, the cursor will be on line 1. Move the cursor down to line 3. When the cursor moves to line 3, the non-painted parts (e.g. "main", "argc", "argv" and the parentheses) are painted as comments. If you move the cursor to line 4 and then back to line 3, it paints those parts normally again. Moving the cursor to line 2 and then line 3 will cause the incorrect painting again.

Dave Lemonby <dreamlax>
Fri 14 Feb 2014 12:56:39 PM UTC, comment #1: 

Can you still reproduce this with current nanos (2.2.6, 2.3.2, or svn)?  I cannot.

Benno Schulenberg <bens>
Group administrator
Wed 08 Apr 2009 01:40:07 AM UTC, original submission:  

I've come across a strange bug where nano paints too far (in 2.1.9).

For example:

1:    /* a test function for testing
2:       but all it does is return 0 */
3:    int test (int arg) {
4:        return 0;
5:    }

Line 3 is wrongfully painted as a comment, but other syntax highlighting such as for the keyword "int" still comes through. In my highlighting rc, comments are magenta, and all of line 3 except for the occurrences of "int" are in magenta.

The strange thing is that moving the cursor from line 4 to line 3 fixes the line, and it becomes painted normally, but if I move the cursor to line 2 and back down to line 3, it paints it wrongfully again.

The changes made to winio.c in revision 2577 introduced this bug for me. I find that commenting out that if-self block where md == CBEGINBEFORE fixes my problems.

I have tried this on both Ubuntu Dapper (yes yes, old I know) and also on Mac OS X 10.5, but it doesn't look like it would be platform-specific anyway.

Dave Lemonby <dreamlax>

 

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

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 dreamlax (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.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-06-13 bens StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2014-05-17 bens StatusConfirmed Ready For Test
    2014-02-21 bens StatusNeed Info Confirmed
        Assigned toNone bens
        SummaryColour syntax highlighting is broken for multi-line highlighting that spans more than 1 line Colour syntax highlighting is broken for multi-line C comments
    2014-02-14 bens StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code