summaryrefslogtreecommitdiffstats
path: root/term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-10-27 13:31:04 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-10-27 13:31:04 +0000
commit4313688a446fb34dd7d7ba53f63060819ff17efd (patch)
tree6b41e6fa3fc2a125358e5e6cc8d4b0a8445a634b /term.c
parent19b7c45c5da55cf8afd4f6546c261a60bf1db390 (diff)
downloadmandoc-4313688a446fb34dd7d7ba53f63060819ff17efd.tar.gz
Fix a regression in term.c rev. 1.229 reported by bentley@:
In UTF-8 output, do not print anything if mchars_spec2cp() returns 0. In particular, this repairs handling of zero-width spaces (\&). While here, let mchars_spec2cp() return 0xFFFD instead of -1 if the character is not found, simplifying the using code. In HTML output, do not print obfuscated ASCII characters and do not test for one-char escapes, mchars_spec2cp() already does that.
Diffstat (limited to 'term.c')
-rw-r--r--term.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/term.c b/term.c
index 8f395a9e..97f6d2bc 100644
--- a/term.c
+++ b/term.c
@@ -468,9 +468,8 @@ term_word(struct termp *p, const char *word)
encode(p, cp, ssz);
} else {
uc = mchars_spec2cp(p->symtab, seq, sz);
- if (uc <= 0)
- uc = 0xFFFD;
- encode1(p, uc);
+ if (uc > 0)
+ encode1(p, uc);
}
break;
case ESCAPE_FONTBOLD:
@@ -705,9 +704,8 @@ term_strlen(const struct termp *p, const char *cp)
} else {
c = mchars_spec2cp(p->symtab,
seq, ssz);
- if (c <= 0)
- c = 0xFFFD;
- sz += cond_width(p, c, &skip);
+ if (c > 0)
+ sz += cond_width(p, c, &skip);
}
break;
case ESCAPE_SKIPCHAR: