ref: 0f9fbb72938ceda4760694d43db5647f75ae2a37
parent: b71732ca1b5129e0575afda791300457beb19b5d
author: Ali Gholami Rudi <[email protected]>
date: Fri Apr 26 15:22:30 EDT 2013
ren: .in should clear .ti Also .ti should override .in
--- a/adj.c
+++ b/adj.c
@@ -4,7 +4,7 @@
#include <string.h>
#include "xroff.h"
-#define ADJ_LLEN(a) ((a)->ll > (a)->li + (a)->lt ? (a)->ll - (a)->li - (a)->lt : 0)
+#define ADJ_LLEN(a) MAX(0, (a)->ll - ((a)->lt >= 0 ? (a)->lt : (a)->li))
struct word {
int beg; /* word beginning offset */
@@ -50,7 +50,7 @@
adj->ll = adj->l;
adj->li = adj->i;
adj->lt = adj->t;
- adj->t = 0;
+ adj->t = -1;
}
/* does the adjustment buffer need to be flushed without filling? */
--- a/ren.c
+++ b/ren.c
@@ -197,7 +197,7 @@
{
int ljust = 0;
char cmd[32];
- int llen = ll - li - lt;
+ int llen = ll - (lt >= 0 ? lt : li);
n_n = w;
if (n_u && !n_na && (n_j == AD_C || n_j == AD_R))
ljust = n_j == AD_C ? (llen - w) / 2 : llen - w;
@@ -206,13 +206,14 @@
if (cdiv) {
if (cdiv->dl < w)
cdiv->dl = w;
- if (ljust + lt) {
- sprintf(cmd, "\\h'%du'", lt + ljust);
+ ljust += lt >= 0 ? lt : li;
+ if (ljust) {
+ sprintf(cmd, "\\h'%du'", ljust);
sbuf_append(&cdiv->sbuf, cmd);
}
sbuf_append(&cdiv->sbuf, s);
} else {
- out("H%d\n", n_o + li + lt + ljust);
+ out("H%d\n", n_o + (lt >= 0 ? lt : li) + ljust);
out("V%d\n", n_d);
out_line(s);
}
@@ -366,6 +367,7 @@
n_i0 = n_i;
n_i = MAX(0, in);
adj_in(cadj, n_i);
+ adj_ti(cadj, -1);
}
void tr_ti(char **args)