bugGNU nano - Bugs: bug #51355, commenting via Meta-3 works even...

 
 

bug #51355: commenting via Meta-3 works even when the syntax's comment=""

Submitted by:  David Lawrence Ramsey <dolorous>
Submitted on:  Sun 02 Jul 2017 07:02:08 AM UTC  
 
Severity: 3 - NormalStatus: Fixed
Assigned to: David Lawrence Ramsey <dolorous>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sun 02 Jul 2017 06:04:27 PM UTC, comment #5:

Fixed in git, 2abe7c03. Thanks for the patch.

Benno Schulenberg <bens>
Project Administrator
Sun 02 Jul 2017 08:13:29 AM UTC, comment #4:

Argho. Attached one last tweaked version of the patch: the comment of "#" is only set for every syntax in rcfile.c if ENABLE_COMMENT is defined, as it should have been before.

(file #41104)

David Lawrence Ramsey <dolorous>
Project AdministratorIn charge of this item.
Sun 02 Jul 2017 08:00:43 AM UTC, comment #3:

Attached an improved version of the patch that preserves nano's behavior: the comment of "#" is now the default for every syntax, even "none", unless it is explicitly overridden with something else, or unless it is explicitly unset by setting it to "".

(file #41102)

David Lawrence Ramsey <dolorous>
Project AdministratorIn charge of this item.
Sun 02 Jul 2017 07:24:19 AM UTC, comment #2:

Note that the patch changes nano's behavior in one way: if a syntax has no 'comment' line, it now gets treated as though it has a 'comment=""' line and gets its commenting disabled, as opposed to falling through to the default comment of "#" as it did before. (This is rooted in by the rcfile parsing code, which, according to comments, treats setting something to "" as equivalent to unsetting something.) Although the syntax "none" still gets the "#" comment.

David Lawrence Ramsey <dolorous>
Project AdministratorIn charge of this item.
Sun 02 Jul 2017 07:05:15 AM UTC, comment #1:

And the attached patch should fix it. The check for a nonexistent comment wasn't quite right, so the comment was erroneously always left at the default value.

(file #41101)

David Lawrence Ramsey <dolorous>
Project AdministratorIn charge of this item.
Sun 02 Jul 2017 07:02:08 AM UTC, original submission:

In current git (d1ee41f), commenting lines en masse by using Meta-3 always works, even when it shouldn't. This can be reproduced as follows, assuming nano was built with --enable-color and --enable-comment:

1. From the src/ directory, run: ./nano -Y json files.c

2. Press Meta-3. The first line of files.c will have the default comment of "#" added to the left of its text.

json.nanorc has its comment string set to "", and according to the nanorc man page, this is supposed to disable commenting. So step 2 should fail to comment the line and then display "Commenting is not supported for this file type" on the statusbar.

David Lawrence Ramsey <dolorous>
Project AdministratorIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

 

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 dolorous (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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 22 Jul 2017 07:10:50 PM UTCbensOpen/ClosedOpen=>Closed
    Sun 02 Jul 2017 06:04:27 PM UTCbensStatusNone=>Fixed
      Assigned toNone=>dolorous
    Sun 02 Jul 2017 08:13:28 AM UTCdolorousAttached File-=>Added 0001-tweaks-make-sure-commenting-is-disabled-when-comment.patch, #41104
    Sun 02 Jul 2017 08:00:43 AM UTCdolorousAttached File-=>Added 0001-tweaks-make-sure-commenting-is-disabled-when-comment.patch, #41102
    Sun 02 Jul 2017 07:05:15 AM UTCdolorousAttached File-=>Added 0001-tweaks-make-sure-commenting-is-disabled-when-comment.patch, #41101

    Back to the top


    Powered by Savane 3.1-cleanup1