Hi Ingo,

On Wed, Jan 08, 2025 at 08:57:04PM +0100, Ingo Schwarze wrote:
> >     alx@devuan:~/tmp/groff$ cat sy.man 
> >     .TH a s d f
> >     .SH g
> >     .SY 123456789_123456789_123456789
> >     123456789_123456789_123456789_123456789_123456789_123456789
> 
> So you are talking about a combination of very long command names
> with very long arguments causing ugly formatting by overrunning the
> right margin (in some output modes).
> 
> None of that requires author intervention to solve because if desired,
> the macro set can automatically detect overruns and take appropriate
> action.
> 
> Actually, none of that *can* even be solved by the author because
> the problem depends on the output mode and even on mode-specific
> output parameters like the paper width (in typeset output) or the
> line length (in terminal output).

[...]

> 
> >       int dl_iterate_phdr(
> >               typeof(int (struct dl_phdr_info *info, size_t size, void 
> > *data))
> >                   *callback,
> >               void *data);
> 
> A particularly simple way to achieve that would be to build a maximum
> indentation into .SY and let man(7) wrap the line before the arguments
> if the length of the command name exceeds that maximum, similar to
> what the groff_man(7) manual page describes for .TP, except that a
> modern language should not allow the document author to manually
> specify the width like .TP does - at least not for a macro that is
> intended to be semantic, like .SY.

Agree.  I think I thought about that, but for some reason I forgot to
consider that possibility when writing the email.

So, let's break the line before the first parameter if it would overrun
the right margin (-rLL=NNn), and automagically calculate an appropriate
indentation for the first parameter.

As for the right indentation, I'd make it the exact indentation that
would make the first parameter touch the right margin, with a minimum
indentation of 2n (being such a rare case, I'd hardcode this value; it
shouldn't be hit under normal conditions).  Let's write some examples:

        foo baaar  |
        foo baaaar |
        foo baaaaar|
        foo        |
           baaaaaar|
        foo        |
          baaaaaaar|
        foo        |
          baaaaaaaar            << Overruns the right margin.
        foo        |
          baaaaaaaaar           << Overruns the right margin.

Does this sound good?


Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature

Reply via email to