[Top][All Lists]

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

[Nano-devel] okay to change the behavior of indent/unindent?

From: Benno Schulenberg
Subject: [Nano-devel] okay to change the behavior of indent/unindent?
Date: Sun, 9 Jul 2017 10:18:06 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Op  9-07-2017 om 04:30 schreef David Ramsey:
After studying the indent/unindent code and looking at bug #47684,

Also see

* The behavior of indent/unindent should be more consistent.

To clarify: currently, with the default settings, when indenting,
nano will insert a tab /after/ the leading whitespace of a line,
meaning that the text will move to the next "tab stop": the next
multiple of eight.  When --tabstospaces is used, however, nano
will simply insert eight spaces after the leading whitespace,
meaning that the text moves a full eight positions further.

Those two behaviors are inconsistent.  And that is why we concluded
in the above two bugs that nano should add the tabs or spaces to the
/beginning/ of each affected line, so that the text will always move
the same amount, no matter whether --tabstospaces is used, nor whether
there is any number of leading spaces that is less than a full tab's
worth (which means that it will preserve any partial indents).

Anyone who disagrees with this change in behavior?

Indenting will add tabs to the beginnings of the lines it affects (or full tabs' worth of spaces if the --tabstospaces option is used). Unindenting will remove
tabs from the beginnings of the lines it affects (if the lines begin with tabs;
it will remove them whether they consist of actual tabs or full tabs' worth of

Meaning that also unindent will preserve partial indents, something
that it currently /seems/ to do, but doesn't do when you first do an
indent.  This means that currently you can normalize the indentation
of a piece of text, by selecting it, indenting it and unindenting it.
Any difference in indentation that is less than a tab's width will
be gone.  With the new behavior this normalization "feature" will
no longer work: any difference in indentation will be preserved.

(I haven't yet looked at the patch set, nor tested it.  I'm a bit
low on time these days.)


reply via email to

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