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

 
 

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

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

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

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

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

Benno Schulenberg <bens>
Group 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>
Group Member
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>
Group Member
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>
Group Member
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>
Group Member
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>
Group Member

 

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

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2017-07-22 bens Open/ClosedOpen Closed
    2017-07-02 bens StatusNone Fixed
        Assigned toNone dolorous
    2017-07-02 dolorous Attached File- Added 0001-tweaks-make-sure-commenting-is-disabled-when-comment.patch, #41104
    2017-07-02 dolorous Attached File- Added 0001-tweaks-make-sure-commenting-is-disabled-when-comment.patch, #41102
    2017-07-02 dolorous Attached File- Added 0001-tweaks-make-sure-commenting-is-disabled-when-comment.patch, #41101

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code