aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rwxr-xr-xmnpgr.tl5
2 files changed, 8 insertions, 2 deletions
diff --git a/README.md b/README.md
index 47b8a24..b2184c2 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,11 @@ syntax coloring, like what you see `less`.
Because `mngpr` itself resolves the overstrikes, the resulting rendering
in Vim is searchable.
+Another benefit of `mnpgr` is that it replaces with a plain ASCII dash
+(U+002D) all the nonsense Unicode dashes output by GNU groff.
+This is not just esthetics. In some systems, the U+2010 hyphen
+seriously corrupts the terminal display, rendering man pages unreadable.
+
## Installation
The `mnpgr.vim` file goes into your `~/.vim/syntax` directory, which
diff --git a/mnpgr.tl b/mnpgr.tl
index 46619c9..3256815 100755
--- a/mnpgr.tl
+++ b/mnpgr.tl
@@ -97,7 +97,8 @@
(with-resources ((rendered-file (path-cat mnpgr-dir `@page.@section.@cols`)
(remove-path rendered-file)))
(with-stream (s (open-file rendered-file "w"))
- (let ((ofilt (make-overstrike-filter (lambda (str) (put-string str s)))))
+ (let ((hfilt (op regsub #/[\x2010\x2013\x2014\x2212]/ "-"))
+ (ofilt (make-overstrike-filter (lambda (str) (put-string str s)))))
(whilet ((line (get-line)))
- [ofilt line])))
+ (flow line hfilt ofilt))))
(sh `vim +'@{vim-commands}' '@{rendered-file}' < /dev/tty`))))