[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] snipping almost twenty lines out of the commenting code
From: |
Mike Scalora |
Subject: |
Re: [Nano-devel] snipping almost twenty lines out of the commenting code |
Date: |
Wed, 1 Jun 2016 21:42:29 -0600 |
It looks pretty good.
Not resetting comment_seq on each use (now that it is a file global)
appears to have a strange side effect for syntaxes without a comment
setting. A file with a syntax that has no comment setting inherits the
last comment sequence that was used on a previous file or other
buffer. I use some syntax files from github that don't have comment
(yet) and the problem showed up for those files after I had used
comment or uncomment on a file with any non-# setting. I think
resetting it to "#" in do_comment() right after #ifndef DISABLE_COLOR
would fix that issue.
Calling discard_until() makes things work a bit different in a subtle
way. It deletes the redo side of the undo stack. If the comment action
had changed a line it would have been lost so it's not a serious
effect but different in a small way.
I'm not a fan of using a global to eliminate a function but given how
much you value fewer lines and the historical use of globals in the
codebase I guess it's the thing to do.
-Mike
On Wed, Jun 1, 2016 at 2:00 AM, Benno Schulenberg
<address@hidden> wrote:
> Hello Mike,
>
> See attached patch.
>
> Instead of having a special add_comment_undo() function, it just
> uses the general mechanism. The only drawback that I see is that
> when you get the "Cannot comment past end of file" warning, you
> /can/ undo and redo this action but nothing actually happens.
>
> If you have a one-liner that prevents that...
>
> Benno
- [Nano-devel] snipping almost twenty lines out of the commenting code, Benno Schulenberg, 2016/06/01
- Re: [Nano-devel] snipping almost twenty lines out of the commenting code, Benno Schulenberg, 2016/06/01
- Re: [Nano-devel] snipping almost twenty lines out of the commenting code,
Mike Scalora <=
- Re: [Nano-devel] snipping almost twenty lines out of the commenting code, Benno Schulenberg, 2016/06/03
- Re: [Nano-devel] snipping almost twenty lines out of the commenting code, Mike Scalora, 2016/06/03
- Re: [Nano-devel] snipping almost twenty lines out of the commenting code, Benno Schulenberg, 2016/06/03
- Re: [Nano-devel] snipping almost twenty lines out of the commenting code, Benno Schulenberg, 2016/06/08
- Re: [Nano-devel] snipping almost twenty lines out of the commenting code, Mike Scalora, 2016/06/09
- [Nano-devel] tabsizes and indentsizes, Benno Schulenberg, 2016/06/11