On Tue, Oct 28, 2025 at 04:32:50AM -0500, G. Branden Robinson wrote:
> At 2025-10-28T04:18:33-0400, Thomas Dickey wrote:
> > On Mon, Oct 27, 2025 at 07:58:42PM -0500, G. Branden Robinson wrote:
> [rearranging]
> > > AC_DEFUN([TBL_SUPPORTS_X_COLUMN_MODIFIER], [
> [snip]
> > thanks - I can adapt this (use it as a starting point)
>
> Sounds good to me. Regarding the sed part of the remedy...
>
> > > At 2025-10-27T04:15:57-0400, Thomas Dickey wrote:
> > > > If it's "only" the s/Lx/L/g, then that could be done with a
> > > > configure check for the special case of antique nroff, and a
> > > > substitution for make-sed.sh
> > >
> > > That's true. In my opinion 'x' is too nice a feature to do without
> > > unless one has to, so it's worth complicating your CF_MAN_PAGES
> > > Autoconf macro to take care of it.
>
> ...I've taken a pass over every tbl(1) region in the ncurses man pages,
> and am preparing a bunch of minor fixups.
>
> 26cbbe6b3 man/captoinfo.1m: Clarify tbl portability comment.
> a1e560fe4 man/menu.3x: Delete extra spaces before tabs.
> cd7ebb5ef man/{form,menu}.3x: Fix table style nit.
> 820fd7165 man/*: Respell table formats.
> ae1cce74e man/user_caps.5: Tweak table format.
> 1d3d8bef9 man/curs_{terminfo,util}.3x: Tweak table formats.
> b59c6f28e include/Caps: Prevent page break in table start.
>
> I used the following technique to extract all the table definitions for
> inspection.
>
> $ sed -n '/^\.TS/,/\.$/p' include/* man/*| grep -Ev '(TS|center|tab)'
>
> The foregoing forthcoming patches clean up inconsistencies.
>
> Next, it's looking to me like we can do better than just 's/Lx/L/g'.
>
> What I _think_ we can do is 's/Lx/Lw(24n)/'.
>
> You don't need 'g' because only one 'x' column modifier appears in any
> row of any table in the ncurses man pages; that's to work around DWB 3.3
> tbl itself. (It still throws a spurious warning, and has for as long as
> 'x' has been present in the tables.[1])
>
> 28n is how much line length is left over after subtracting from 65n the
> widths of the other columns in the most cramped tables in the corpus:
> the terminfo capability lists. 65n is the line length that AT&T troff
> (including DWB troff) and its descendants in System V and Plan 9 use.
>
> Lb Cb S Lb
> Lb Lb Lb Lb
> Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
>
> The third column is for termcap codes; its width is never more than 2.
>
> 65-(25+2+8+2+2+2)=24
>
> These appear to be the most demanding tables in the corpus. My thinking
> is that we can perform the foregoing substitution and preserve
> equivalent results to 'x' in nroff mode for less featureful tbl
> programs, and still have better-than-default column widths for text
> blocks in every other table in the ncurses man pages. Lesk in CSTR #49
> (1976, revised 1979)--and the GNU tbl man page--present the formula for
> text block width computation.
>
> (GNU) tbl(1):
> Text blocks
> ...
> If w or x modifiers are not specified for all columns of a text
> block’s span, the default length of the text block (more precisely,
> the line length used to process the text block’s diversion) is
> computed as L×C/(N+1), where L is the current line length, C the
> number of columns spanned by the text block, and N the number of
> columns in the table. ...
>
> Assuming a 2 column table (ncurses has no 1 column tables, and seems
> never to use text blocks in spanned columns), that default is
> (65n*1)/(2+1) = 21n. 24n is wider/better. For tables with more
> columns, the result should be better still--long as they don't overset.
>
> I haven't submitted patches for this yet because I need to test my
> suspicion. The aforementioned ones were to get things in place so I
> could perform my proposed substitution and compare the resuling outputs
> using my usual battery of formatters. I think I'll be testing Plan 9
> from User Space more often going forward as a proxy for Solaris 10. OnI hadn't noticed that, but see it now. > the other hand, I've also started looking into adding support for 'x' > (on at most one column per table, just like DWB 3.3) to P9US by cribbing > code from DWB 3.3, but it's not trivially easy because DWB apparently > decided to heavily refactor tbl at some point, which maybe explains why > this feature didn't cross-pollinate back into Plan 9 35 years ago. So > far the P9US guys have been really receptive to my suggestions regarding > troff and man(7). > > Consequently, maybe I should install Dell SVr4 Unix into a virtual > machine and play with that when I need an authentic System V experience. > I've kind of been wanting to do that anyway. > > https://virtuallyfun.com/wordpress/2020/12/01/dell-unix-on-86box/ I don't see a mention of a compiler for that. > I'll follow up when I know whether my 's/Lx/Lw(24n)/' trick works. > > Regards, > Branden > > [1] In the course of composing this email, I found what I think is a > near-minimal reproducer for DWB 3.3 tbl's spurious warning. > > $ cat /tmp/dwb-tbl-blunder.roff > .TS > Lx. > table > .TE > .TS > tab(@); > L Lx. > second@table > .TE > $ DWBHOME=~/dwb ~/dwb/bin/tbl /tmp/dwb-tbl-blunder.roff >/dev/null > tbl: File /tmp/dwb-tbl-blunder.roff, line 7: Warning: Too many columns with > 'x' modifier. > > I'll bet the DWB 3.x guys forgot to reset a variable when processing > multiple table regions in a document. > > Nils-Peter Nelson, I accuse YOU! > > But maybe it was Jaap Akkerhuis. > > Or someone else. > > https://lists.gnu.org/archive/html/groff/2022-12/msg00097.html -- Thomas E. Dickey <[email protected]> https://invisible-island.net
signature.asc
Description: PGP signature
