[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] Comment/Uncomment feature patch

From: Mike Scalora
Subject: Re: [Nano-devel] Comment/Uncomment feature patch
Date: Wed, 20 Apr 2016 06:36:18 -0600

On Wed, Apr 13, 2016 at 3:30 AM, Benno Schulenberg <address@hidden> wrote:

> Uncomment right after comment will almost always return the document to the
> prior state but uncomment by itself can be irreversible.

Then undo /must/ work for this.


> It appears that indent/unindent is not undoable, neither is
> comment/uncomment. I looked into making both undoable but didn't get very
> far. I would have to spend a lot of time to deeply understand how the undo
> mechanism is designed.

It's complicated.  There was some discussion about this two years ago,
and a partial patch for the unindent case.  See



-- - The professional email service

I worked on comment/uncomment undo/redo for the last few days while I was traveling. I tried to keep indent/unindent in mind so that the same/similar impl can be used to solve that issue.

It is not clear to me what the desired behaviour is for indent when there are existing partial indents, mixed spaces and tabs on lines being indented. Of course, my goal for undo would be to restore the document to the exact same bytes regardless of how it works, in one 'undo' action, not one or two per line as the impl linked above appears to work.

It is curious to me that nano's own source is formatted with 8 char tab and uses 4 char indent but the indent feature appears to use tab width as the indent width. Am I reading it wrong? Was that a compromise that should be addressed if/when I dig into indent/undo?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]