nano-devel
[Top][All Lists]
Advanced

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

Re: the justifying of indented text


From: Seb
Subject: Re: the justifying of indented text
Date: Tue, 17 Dec 2019 23:01:30 +0100 (CET)
User-agent: Alpine 2.21 (DEB 202 2017-01-01)


Hi Benno,


This is indeed a matter that requires a delicate touch.

I've changed your example a bit, because the "\noindent" on a line that is itself indented was confusing.

Yes, sorry. I often use \noindent in LaTeX source files.

    \somecommand
    Lorem ipsum dolor sit amet, consectetur adipiscing elit

Each line starts with a <Tab> and there is no more text than that. When the
cursor is on the second line, I expect ^J to leave the two lines alone.

Why do you expect that?  Just because that is how Pico did it?

"Because Pico (and previous Nano versions) did it", in other words "Because that's been my editor's behavior for the past twenty five years", is indeed a reason that comes to mind. And not a trivial one, I may add.

To complicate matters further, older nanos (before 2.9.8) would leave the "/somecommand" alone and would justify only the two lines that start with "Lorem ipsum...". (That is the behavior you seem to want.) *But*, when one used --autoindent, then a ^J would rewrap all three lines as a single paragraph at once. So... this means you never used --autoindent, or you toggled it off before you type ^J?

I adapt my editor to what I type.

If I'm writing a text, or the text part of a mixed text/code file (such as a
LaTeX file, or an HTML file), I usually don't use autoindent.

If I'm writing code, including the code part of a mixed file, I use
autoindent.

I start Nano via a script that sets a few command-line options depending on
the file's extension. For instance, I use Tab = 4 spaces for scripting but
Tab = 2 spaces for HTML. Auto-indent is automatically on for scripts and off
for text. When in doubt (eg .tex), autoindent is off.

In the middle of a session, I use Esc-I to change the behavior when the need
arises.

Or because you think that indented lines should never be rewrapped? Or to be more precise: that an indented line can only ever be the start of a paragraph, never the continuation of a paragraph? If you opine the latter, please give your reasoning.
[...]
But I don't know what to do about it. I can make a patch that would consider any line that starts with a tab as the start of a paragraph, but I don't think that would be a good default behavior, as it would prevent justifying an indented comment block. True, the latter is not very common, but it is what makes ^J useful when writing code. And to add an option that determines how to behave when finding a tab-indented line... that goes too far.

Here is my reasoning.

* if autoindent is OFF (which in my mind means "I'm writing text"):

        Yes, an indented line can only ever be the start of a paragraph
        because that's pretty much the definition of a paragraph in a text.

* If autoindent in ON:

        Two lines sharing the same amount of space at the beginning of either
        line belong to the same paragraph.

* Comments follow a dual rule. Consider this example:

        %       Jusqu'en 2014, le moteur de LaTeX incluait un bug léger dans
        % \addpenalty, du fichier ltspace.dtx (dans une TeXLive). Il était
        % corrigé via le fichier fixltx2e.dtx, qui était appelé en \usepackage.
        %       À partir de 2015, TeXLive a fusionné ces fichiers. Or le 
changement
        % dans la définition de \addpenalty a fait que des corrigés compilaient
        % différemment selon qu'ils étaient compilés sur une TeXLive 2014 (qui
        % était incluse dans la Debian stable début 2017) ou sur une TeXLive
        % 2015+ (cas d'Ubuntu et de la nouvelle Debian stable arrivée en milieu
        % de session).
        %       La correction de ce bug n'améliore pas les Annales en pratique. 
Il
        % est plus important que la compilation soit la même partout. C'est
        % pourquoi on met ci-dessous l'ancienne définition de \addpenalty.

        The "%" symbols need to stay vertically aligned (let's say that "%" is
        in quotestr). Whatever happens after "%" does not count. Autoindent or
        not.

        In the comment's text, the separation into three paragraphs conveys
        meaning and should be preserved if the user wishes so: if autoindent is
        OFF, keep the paragraphs; if it is ON, fuse them together. In other
        words, treat the comment's text as if ^\s+%\s brought the column count
        down to 1 and we're back to the non-comment case.

Does that make sense?


Kind regards,
Sébastien.

reply via email to

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