aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/msgviewer.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-10-28 12:20:21 -0500
committerRobin Jarry <robin@jarry.cc>2022-11-06 23:17:48 +0100
commit2cbcdf3175211fdbb7c36f37ea5254c5e6ffe79d (patch)
tree68a5ddc146e642364e7bd3d5f81dbbe358281f02 /widgets/msgviewer.go
parent229e7b68af38c2dda37a3191c0f70f5d2e872294 (diff)
downloadaerc-2cbcdf3175211fdbb7c36f37ea5254c5e6ffe79d.tar.gz
msgviewer: warn user when pager is not in PATH
Warn user when configured pager is not in PATH. Attempt fallbacks, and throw error if none of the fallbacks are in PATH. Fixes: https://todo.sr.ht/~rjarry/aerc/94 Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets/msgviewer.go')
-rw-r--r--widgets/msgviewer.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index 7365dc53..837c0608 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -529,7 +529,17 @@ func NewPartViewer(acct *AccountView, conf *config.AercConfig,
pagerin io.WriteCloser
term *Terminal
)
- cmd, err := shlex.Split(conf.Viewer.Pager)
+ cmds := []string{
+ conf.Viewer.Pager,
+ os.Getenv("PAGER"),
+ "less -R",
+ }
+ pagerCmd, err := acct.aerc.CmdFallbackSearch(cmds)
+ if err != nil {
+ acct.PushError(fmt.Errorf("could not start pager: %w", err))
+ return nil, err
+ }
+ cmd, err := shlex.Split(pagerCmd)
if err != nil {
return nil, err
}