aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-10-22 12:36:12 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-10-22 12:36:12 -0700
commitc16466e9d12aeea064fa3b0d2b3f0823c152b5f8 (patch)
treec242825364531420699c52b3dd25b963de3e436f
parent8270e33c0a820ccb14c1cc6b97460db0a5748f0a (diff)
downloadmnpgr-c16466e9d12aeea064fa3b0d2b3f0823c152b5f8.tar.gz
mnpgr-c16466e9d12aeea064fa3b0d2b3f0823c152b5f8.tar.bz2
mnpgr-c16466e9d12aeea064fa3b0d2b3f0823c152b5f8.zip
Interpolate number of columns into name.
- Problem: if the user views the same man page from different terminal windows that don't have the same width, the remembered locations don't make sense. - Solution: interpolate the width into the temporary file name, so that Vim remembers the position separately for each width.
-rwxr-xr-xmnpgr.tl6
1 files changed, 5 insertions, 1 deletions
diff --git a/mnpgr.tl b/mnpgr.tl
index 1d9d0ec..4278f3e 100755
--- a/mnpgr.tl
+++ b/mnpgr.tl
@@ -34,6 +34,10 @@
"map b \002\r"
"map <space> \006")))
+(defvarl cols (or (getenv "MANWIDTH")
+ (getenv "COLUMNS")
+ "80"))
+
(defun grave-accent (x)
(casequal x
("a" "à")
@@ -90,7 +94,7 @@
(match @(or `@page(@section)` ;; for "man whatever"
`@page\\.@section`) ;; for "man -l file.1"
(getenv "MAN_PN")
- (with-resources ((rendered-file (path-cat mnpgr-dir `@page.@section`)
+ (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)))))