bugGNU nano - Bugs: bug #60456, a carriage return is wrongly...

 
 

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

bug #60456: a carriage return is wrongly colored as valid whitespace

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Mon 26 Apr 2021 05:26:29 PM UTC  
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  Benno Schulenberg <bens> Open/Closed:  Closed

Tue 27 Apr 2021 09:45:25 AM UTC, comment #1: 

Fixed in git, commit 544351f3, by replacing character class [[:space:]] with [[:blank:]] in most places.

In most places the use of [[:space:]] was meant to have some blank space between the preceding text and a subsequent comment or keyword, to avoid wrongly colorizing stuff that is embedded in something else.  This blank space should be actually blank and not something visible like ^K or ^L or ^M.

(I've left the [[:space:]] things in texinfo.nanorc, because there it was easy to check that any whitespace is valid anywhere and does not affect the final output.)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Mon 26 Apr 2021 05:26:29 PM UTC, original submission:  

To reproduce, run:

src/nano +31,9 src/text.c

See that the cursor is between #include and <time.h>.
Now type: <Del> M-V ^M ^S ^X
and then run 'make'.  Result:

text.c:31:9: error: #include expects "FILENAME" or <FILENAME>

Apparently a carriage return is not valid whitespace in a C file (at least: not in that particular place).  When instead of ^M we typed ^K (vertical tab) or ^L (form feed), then the compiler does not complain.

So... sometimes the use of [[:space:]] in nano's syntaxes is incorrect, and [[:blank:]] should be used instead.  The latter does not include the form feed (\f) and the vertical tab (\v), so things that contain them would wrongly not be colored as valid, but... who uses those anyway?  Also, it is more important to not wrongly color things as valid that are invalid as to color every possible valid thing as valid.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.

 

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 (Submitted the item)
  •  

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

    Only logged-in users can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-04-30 bens Open/ClosedOpen => Closed
    2021-04-27 bens StatusNone => Fixed

    Back to the top


    Powered by Savane 3.7