summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorG. Branden Robinson <g.branden.robinson@gmail.com>2023-02-03 02:22:02 -0600
committerG. Branden Robinson <g.branden.robinson@gmail.com>2023-02-03 12:01:34 -0600
commit8f066786ea3cb5e1dbade1149e7d50ae978da202 (patch)
tree131172d0b50d51bdb90465667fa501921207b376 /src
parent159d8346f3756301e436d2f55bfe0fa729b48f94 (diff)
downloadgroff-git-8f066786ea3cb5e1dbade1149e7d50ae978da202.tar.gz
[tbl]: Improve symmetry of tables in nroff mode.
* src/preproc/tbl/table.cpp (table::compute_column_positions): If a table has "left separation" (it is boxed, or has a vertical rule on the left-hand side), increase the first column's start register value by 1n, for symmetry with the right-hand size. * src/preproc/tbl/tests/check-horizontal-line-length.sh: * src/preproc/tbl/tests/check-line-intersections.sh: * src/preproc/tbl/tests/check-vertical-line-length.sh: Update output expectations. * src/preproc/tbl/tbl.am (tbl_XFAIL_TESTS): Remove now-passing test. Before: +--+---+---+ |a | b | c | +--+---+---+ |d | e | f | +--+---+---+ |g | h | i | +--+---+---+ After: +---+---+---+ | a | b | c | +---+---+---+ | d | e | f | +---+---+---+ | g | h | i | +---+---+---+
Diffstat (limited to 'src')
-rw-r--r--src/preproc/tbl/table.cpp2
-rw-r--r--src/preproc/tbl/tbl.am1
-rwxr-xr-xsrc/preproc/tbl/tests/check-horizontal-line-length.sh8
-rwxr-xr-xsrc/preproc/tbl/tests/check-line-intersections.sh2
-rwxr-xr-xsrc/preproc/tbl/tests/check-vertical-line-length.sh2
5 files changed, 8 insertions, 7 deletions
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 126f1c2d2..0d1b13186 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -2287,6 +2287,8 @@ void table::compute_column_positions()
printfs(".nr %1 %2*\\n[" SEPARATION_FACTOR_REG "]\n",
column_start_reg(0),
as_string(left_separation));
+ if (left_separation)
+ printfs(".if n .nr %1 +1n\n", column_start_reg(0));
int i;
for (i = 1;; i++) {
printfs(".nr %1 \\n[%2]+\\n[%3]\n",
diff --git a/src/preproc/tbl/tbl.am b/src/preproc/tbl/tbl.am
index 8de8da607..4333b732a 100644
--- a/src/preproc/tbl/tbl.am
+++ b/src/preproc/tbl/tbl.am
@@ -48,7 +48,6 @@ TESTS += $(tbl_TESTS)
EXTRA_DIST += $(tbl_TESTS)
tbl_XFAIL_TESTS = \
- src/preproc/tbl/tests/boxes-and-vertical-rules.sh \
src/preproc/tbl/tests/expand-region-option-works.sh \
src/preproc/tbl/tests/table-lacks-spurious-top-border.sh \
src/preproc/tbl/tests/x-column-modifier-works.sh
diff --git a/src/preproc/tbl/tests/check-horizontal-line-length.sh b/src/preproc/tbl/tests/check-horizontal-line-length.sh
index eeb49133e..3d5e2a23c 100755
--- a/src/preproc/tbl/tests/check-horizontal-line-length.sh
+++ b/src/preproc/tbl/tests/check-horizontal-line-length.sh
@@ -56,8 +56,8 @@ _
echo "checking intersection of vertical and horizontal rules" >&2
output=$(printf "%s" "$input" | "$groff" -Tascii -t)
-echo "$output" | sed -n '1p' | grep -Eqx '\+-{11}\+' || wail
-echo "$output" | sed -n '3p' | grep -Eqx '\+-{11}\+' || wail
+echo "$output" | sed -n '1p' | grep -Eqx '\+-{12}\+' || wail
+echo "$output" | sed -n '3p' | grep -Eqx '\+-{12}\+' || wail
input='.ll 12n
.TS
@@ -70,8 +70,8 @@ L.
echo "checking width of boxed table" >&2
output=$(printf "%s" "$input" | "$groff" -Tascii -t)
-echo "$output" | sed -n '1p' | grep -Eqx '\+-{11}\+' || wail
-echo "$output" | sed -n '3p' | grep -Eqx '\+-{11}\+' || wail
+echo "$output" | sed -n '1p' | grep -Eqx '\+-{12}\+' || wail
+echo "$output" | sed -n '3p' | grep -Eqx '\+-{12}\+' || wail
test -z "$fail"
diff --git a/src/preproc/tbl/tests/check-line-intersections.sh b/src/preproc/tbl/tests/check-line-intersections.sh
index 98f803639..2012bebaf 100755
--- a/src/preproc/tbl/tests/check-line-intersections.sh
+++ b/src/preproc/tbl/tests/check-line-intersections.sh
@@ -42,7 +42,7 @@ echo "$output"
for l in 1 3 5 7
do
echo "checking intersections on line $l"
- echo "$output" | sed -n ${l}p | grep -Fqx '+--+---+---+' || wail
+ echo "$output" | sed -n ${l}p | grep -Fqx '+---+---+---+' || wail
done
# TODO: Check `-Tutf8` output for correct crossing glyph identities.
diff --git a/src/preproc/tbl/tests/check-vertical-line-length.sh b/src/preproc/tbl/tests/check-vertical-line-length.sh
index 9b08dcb68..1aafd0913 100755
--- a/src/preproc/tbl/tests/check-vertical-line-length.sh
+++ b/src/preproc/tbl/tests/check-vertical-line-length.sh
@@ -42,7 +42,7 @@ _
echo "checking length of plain vertical rule" >&2
output=$(printf "%s" "$input" | "$groff" -Tascii -t)
-echo "$output" | sed -n '2p' | grep -Fqx -- '|1234567890 |' || wail
+echo "$output" | sed -n '2p' | grep -Fqx -- '| 1234567890 |' || wail
test -z "$fail"