[Top][All Lists]

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

Re: [Nano-devel] indent/unindent overhaul (including undo/redo support)

From: Benno Schulenberg
Subject: Re: [Nano-devel] indent/unindent overhaul (including undo/redo support)
Date: Tue, 18 Jul 2017 19:29:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Op 15-07-2017 om 21:31 schreef David Ramsey:
Attached version 2 of the indent overhaul, synced with git e4a69f8.

If there is just one line without leading whitespace, nano should be

Counting lines like that seems overly complex, and won't give any
indication of what's wrong if it's only the one line without leading
whitespace.  The latter seems to be a bigger problem.

If you're at the top of the file and you press ^Y, there is no feedback
that you cannot go back any further.  nano and Pico just don't provide
any hint when keystrokes line <PageUp> or <End> don't have any effect.
I think it should be the same when there is even just one line that is
flush with the left edge of the terminal and cannot be unindented --
in my opinion that is plain obvious, more obvious than being at the top
of the file.  (Okay, the relevant line might be offscreen, but still,
the keystroke not having any effect is information enough.)

Right now, the new version skips over lines that are blank or consist
only of whitespace, as you mention in the last paragraph (which means it
doesn't give warnings for them).  For lines that can be indented, it
gives the warning if it finds at least one line that has insufficient

I will look at this in detail when 2.8.6 is out.

Anyway, I think it's an unneeded complication for now.  I think it's
enough when undo restores the /visual/ indentation, it doesn't need to
restore the actual whitespace characters that were there.  This has
the advantage that by unindenting a piece of text and then undoing it,
one can normalize the whitespace (to use all spaces, or all tabs, for
the full indents).  So... I say: remove the meticulous restoration.

(And if we later decide that we do want it, it should be a separate

As for this... I've accommodated you on everything else as best I can,
but the entire point of having undo is to put the text back *exactly* as
it was.  If it doesn't, it's not undo.

Yes, you're right.  I was trying to wriggle my way out of that.  :)

You're seriously saying that I should implement only partial undo, pass
it off as enough because it's less code to implement (even though less
code here would lead to incorrect functionality).  And then, *maybe*
later, implement full undo, and effectively pass it off as though it's a
new feature instead of what undo should have been doing all along?

No, not a new feature, just a mending of our ways.

No.  It's a misuse of the undo code to do that, not to mention false
advertising.  The proper way to normalize the whitespace that you talk
about above is to press Meta-{ to unindent (removing whitespace), and
then press Meta-} to indent the same region (adding normalized

Yes, indeed, that would be the proper way.


reply via email to

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