* mandoc: Suppress spacing before certain kinds of lists.
@ 2017-08-23 20:03 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-08-23 20:03 UTC (permalink / raw)
To: source
Log Message:
-----------
Suppress spacing before certain kinds of lists.
One benefit is a reduced probablity that a blank appears between
a function name and the opening parenthesis introducing the arguments.
The heuristics isn't perfect and may occasionally suppress a blank
that wouldn't do harm.
Modified Files:
--------------
mandoc:
eqn_term.c
gmdiff
mandoc/regress/eqn/matrix:
basic.out_ascii
Revision Data
-------------
Index: eqn_term.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/eqn_term.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -Leqn_term.c -Leqn_term.c -u -p -r1.13 -r1.14
--- eqn_term.c
+++ eqn_term.c
@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <assert.h>
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -67,7 +68,16 @@ eqn_box(struct termp *p, const struct eq
((bp->parent->type == EQN_LIST && bp->expectargs == 1) ||
(bp->parent->type == EQN_SUBEXPR &&
bp->pos != EQNPOS_SQRT)))))) {
- if (bp->parent->type == EQN_SUBEXPR && bp->prev != NULL)
+ if ((bp->parent->type == EQN_SUBEXPR && bp->prev != NULL) ||
+ (bp->type == EQN_LIST &&
+ bp->first != NULL &&
+ bp->first->type != EQN_PILE &&
+ bp->first->type != EQN_MATRIX &&
+ bp->prev != NULL &&
+ (bp->prev->type == EQN_LIST ||
+ (bp->prev->type == EQN_TEXT &&
+ (*bp->prev->text == '\\' ||
+ isalpha((unsigned char)*bp->prev->text))))))
p->flags |= TERMP_NOSPACE;
term_word(p, bp->left != NULL ? bp->left : "(");
p->flags |= TERMP_NOSPACE;
@@ -98,9 +108,9 @@ eqn_box(struct termp *p, const struct eq
term_word(p, bp->pos == EQNPOS_OVER ? "/" :
(bp->pos == EQNPOS_SUP ||
bp->pos == EQNPOS_TO) ? "^" : "_");
- p->flags |= TERMP_NOSPACE;
child = child->next;
if (child != NULL) {
+ p->flags |= TERMP_NOSPACE;
eqn_box(p, child);
if (bp->pos == EQNPOS_FROMTO ||
bp->pos == EQNPOS_SUBSUP) {
Index: gmdiff
===================================================================
RCS file: /home/cvs/mandoc/mandoc/gmdiff,v
retrieving revision 1.8
retrieving revision 1.9
diff -Lgmdiff -Lgmdiff -u -p -r1.8 -r1.9
--- gmdiff
+++ gmdiff
@@ -34,7 +34,7 @@ elif [ "X$1" = "X-u" ]; then
ROFF="groff -ket -ww -Tutf8 -P -c"
MOPT="-Werror -Tutf8 $MOPT"
else
- ROFF="groff -et -ww -Tascii -P -c"
+ ROFF="groff -et -ww -mtty-char -Tascii -P -c"
MOPT="-Werror -Tascii $MOPT"
fi
Index: basic.out_ascii
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/eqn/matrix/basic.out_ascii,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lregress/eqn/matrix/basic.out_ascii -Lregress/eqn/matrix/basic.out_ascii -u -p -r1.3 -r1.4
--- regress/eqn/matrix/basic.out_ascii
+++ regress/eqn/matrix/basic.out_ascii
@@ -4,6 +4,6 @@ N\bNA\bAM\bME\bE
m\bma\bat\btr\bri\bix\bx-\b-b\bba\bas\bsi\bic\bc - matrixes in equations
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
- initial text ((_\ba_11 _\ba_21) (_\ba_12 _\ba_22)) (_\bb_1 _\bb_2) [sin s\bsi\bin\bn] final text
+ initial text ((_\ba_11 _\ba_21) (_\ba_12 _\ba_22)) (_\bb_1 _\bb_2)[sin s\bsi\bin\bn] final text
OpenBSD July 4, 2017 OpenBSD
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-08-23 20:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-23 20:03 mandoc: Suppress spacing before certain kinds of lists 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).