source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: implement so-called absolute horizontal motion: \h'|...', used
@ 2017-06-14 23:24 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-06-14 23:24 UTC (permalink / raw)
  To: source

Log Message:
-----------
implement so-called absolute horizontal motion: \h'|...',
used for example by zoem(1)

Modified Files:
--------------
    mdocml:
        roff.7
        term.c
    mdocml/regress/roff/esc:
        h.in
        h.out_ascii
        h.out_lint

Revision Data
-------------
Index: roff.7
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.7,v
retrieving revision 1.92
retrieving revision 1.93
diff -Lroff.7 -Lroff.7 -u -p -r1.92 -r1.93
--- roff.7
+++ roff.7
@@ -1956,8 +1956,11 @@ and
 .Ss \eH\(aq Ns Oo +|- Oc Ns Ar number Ns \(aq
 Set the height of the current font; ignored by
 .Xr mandoc 1 .
-.Ss \eh\(aq Ns Ar width Ns \(aq
-Horizontal motion relative to the current position.
+.Ss \eh\(aq Ns Oo Cm \&| Oc Ns Ar width Ns \(aq
+Horizontal motion.
+If the vertical bar is given, the motion is relative to the current
+indentation.
+Otherwise, it is relative to the current position.
 The default scaling unit is
 .Cm m .
 .Ss \ek[ Ns Ar name ]
Index: term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/term.c,v
retrieving revision 1.272
retrieving revision 1.273
diff -Lterm.c -Lterm.c -u -p -r1.272 -r1.273
--- term.c
+++ term.c
@@ -526,9 +526,14 @@ term_word(struct termp *p, const char *w
 				p->flags |= (TERMP_NOSPACE | TERMP_NONEWLINE);
 			continue;
 		case ESCAPE_HORIZ:
+			if (*seq == '|') {
+				seq++;
+				uc = -p->col;
+			} else
+				uc = 0;
 			if (a2roffsu(seq, &su, SCALE_EM) == NULL)
 				continue;
-			uc = term_hen(p, &su);
+			uc += term_hen(p, &su);
 			if (uc > 0)
 				while (uc-- > 0)
 					bufferc(p, ASCII_NBRSP);
Index: h.out_ascii
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/roff/esc/h.out_ascii,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/roff/esc/h.out_ascii -Lregress/roff/esc/h.out_ascii -u -p -r1.2 -r1.3
--- regress/roff/esc/h.out_ascii
+++ regress/roff/esc/h.out_ascii
@@ -6,6 +6,7 @@ N\bNA\bAM\bME\bE
 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
      simple: ><
      rounding: >  <
+     absolute: > <
      escape only: ><
      escape at the end: ><
      escape at the beginning: ><
Index: h.in
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/roff/esc/h.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lregress/roff/esc/h.in -Lregress/roff/esc/h.in -u -p -r1.3 -r1.4
--- regress/roff/esc/h.in
+++ regress/roff/esc/h.in
@@ -9,6 +9,8 @@ simple: >\h'0'<
 .br
 rounding: >\h'0.16i'<
 .br
+absolute: >\h'|12n'<
+.br
 escape only: >\h'\w'\&'M'<
 .br
 escape at the end: >\h'0+\w'\&''<
Index: h.out_lint
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/roff/esc/h.out_lint,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lregress/roff/esc/h.out_lint -Lregress/roff/esc/h.out_lint -u -p -r1.3 -r1.4
--- regress/roff/esc/h.out_lint
+++ regress/roff/esc/h.out_lint
@@ -1,2 +1,2 @@
-mandoc: h.in:20:21: WARNING: invalid escape sequence: \h-
+mandoc: h.in:22:21: WARNING: invalid escape sequence: \h-
 mandoc: h.in:1:5: STYLE: Mdocdate missing: Dd May
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-14 23:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-14 23:24 mdocml: implement so-called absolute horizontal motion: \h'|...', used schwarze

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).