From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: discuss@mdocml.bsd.lv
Subject: Re: tbl issues with 1.11.1
Date: Tue, 26 Apr 2011 22:10:50 +0200 [thread overview]
Message-ID: <20110426201050.GA5448@britannica.bec.de> (raw)
In-Reply-To: <20110416213413.GI13629@iris.usta.de>
[-- Attachment #1: Type: text/plain, Size: 572 bytes --]
On Sat, Apr 16, 2011 at 11:34:13PM +0200, Ingo Schwarze wrote:
> > +------+------+
> > |HEAD1 |HEAD2 |
> > |========+======|
> > |cell1 |cell2 |
> > +------+------+
> >
>
> Thanks for the very good report.
> This does indeed look wrong.
> The OpenBSD version is affected as well.
Ingo, that's your change from January. Care to check the attached patch?
It seems to compute the right column widths with one exception. If no |
is used, GNU tbl(1) separates columns by an implicit " ", e.g.
foo_ bar_ baz_
for left-aligned data. That's currently missing.
Joerg
[-- Attachment #2: tbl-layout.diff --]
[-- Type: text/x-diff, Size: 1577 bytes --]
Index: out.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/out.c,v
retrieving revision 1.40
diff -u -p -r1.40 out.c
--- out.c 9 Apr 2011 15:29:40 -0000 1.40
+++ out.c 26 Apr 2011 20:07:03 -0000
@@ -293,7 +293,7 @@ tblcalc_literal(struct rofftbl *tbl, str
case (TBL_CELL_LONG):
/* FALLTHROUGH */
case (TBL_CELL_CENTRE):
- bufsz = (*tbl->len)(1, tbl->arg);
+ bufsz = (*tbl->len)(2, tbl->arg);
break;
default:
bufsz = (*tbl->len)(1, tbl->arg);
Index: tbl_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_term.c,v
retrieving revision 1.19
diff -u -p -r1.19 tbl_term.c
--- tbl_term.c 25 Jan 2011 12:07:30 -0000 1.19
+++ tbl_term.c 26 Apr 2011 20:07:03 -0000
@@ -198,8 +198,6 @@ tbl_hrule(struct termp *tp, const struct
width = tp->tbl.cols[hp->ident].width;
switch (hp->pos) {
case (TBL_HEAD_DATA):
- if (hp->next)
- width += 2;
tbl_char(tp, c, width);
break;
case (TBL_HEAD_DVERT):
@@ -375,9 +373,9 @@ tbl_literal(struct termp *tp, const stru
break;
case (TBL_CELL_CENTRE):
padr = col->width - term_strlen(tp, dp->string);
- if (3 > padr)
+ if (2 > padr)
break;
- padl = (padr - 1) / 2;
+ padl = padr / 2;
padr -= padl;
break;
case (TBL_CELL_RIGHT):
@@ -390,7 +388,7 @@ tbl_literal(struct termp *tp, const stru
tbl_char(tp, ASCII_NBRSP, padl);
term_word(tp, dp->string);
- tbl_char(tp, ASCII_NBRSP, padr + 2);
+ tbl_char(tp, ASCII_NBRSP, padr);
}
static void
next prev parent reply other threads:[~2011-04-26 20:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-14 1:45 Yuri Pankov
2011-04-16 21:34 ` Ingo Schwarze
2011-04-26 20:10 ` Joerg Sonnenberger [this message]
2011-05-12 22:02 ` Joerg Sonnenberger
2011-05-13 21:03 ` Kristaps Dzonsons
2011-05-14 4:12 ` Ingo Schwarze
2011-09-12 20:11 ` Yuri Pankov
2011-09-18 17:25 ` Yuri Pankov
2011-04-17 0:12 ` Joerg Sonnenberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110426201050.GA5448@britannica.bec.de \
--to=joerg@britannica.bec.de \
--cc=discuss@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).