about summary refs log tree commit diff stats
path: root/src/local
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-01-20 01:11:52 +0100
committerbptato <nincsnevem662@gmail.com>2025-01-20 01:11:52 +0100
commit2291b75ed7133b77bce37fcc07500d5081682892 (patch)
treedbbf5d13c34321227c2edcfcd4baffead20c9f30 /src/local
parent9a68d3285ad60a109983bfa406fa958422d415ff (diff)
downloadchawan-2291b75ed7133b77bce37fcc07500d5081682892.tar.gz
pager: do not alert on failed history write if config dir doesn't exist
ref. https://todo.sr.ht/~bptato/chawan/41
Diffstat (limited to 'src/local')
-rw-r--r--src/local/pager.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim
index 0052e18f..f7d7d301 100644
--- a/src/local/pager.nim
+++ b/src/local/pager.nim
@@ -504,7 +504,10 @@ proc cleanup(pager: Pager) =
     pager.term.quit()
     let hist = pager.lineHist[lmLocation]
     if not hist.write(pager.config.external.historyFile):
-      pager.alert("failed to save history")
+      if existsDir(pager.config.dir):
+        # History is enabled by default, so do not print the error
+        # message if no config dir exists.
+        pager.alert("failed to save history")
     if not pager.cookieJars.write(pager.config.external.cookieFile):
       pager.alert("failed to save cookies")
     for msg in pager.alerts: