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

 
 

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

Submitted by:  Dave Lemonby <dreamlax>
Submitted on:  Wed 08 Apr 2009 01:40:07 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Benno Schulenberg <bens>
Open/Closed: ClosedRelease: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

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

Considering this fixed.

Benno Schulenberg <bens>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 13 Jun 2014 08:32:19 PM UTCbensStatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Sat 17 May 2014 08:31:57 PM UTCbensStatusConfirmed=>Ready For Test
    Fri 21 Feb 2014 01:29:03 PM UTCbensStatusNeed 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
    Fri 14 Feb 2014 12:56:39 PM UTCbensStatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup