Add the option to clear the screen when quitting mutt. This is
controlled by the clear_on_quit config option. Defaults to "no".

Signed-off-by: Oskari Pirhonen <xxc3ncore...@gmail.com>
---
 init.h | 6 ++++++
 main.c | 4 ++++
 mutt.h | 1 +
 3 files changed, 11 insertions(+)

diff --git a/init.h b/init.h
index 3ccb7382..5f42730b 100644
--- a/init.h
+++ b/init.h
@@ -661,6 +661,12 @@ struct option_t MuttVars[] = {
   ** this variable is \fIunset\fP, no check for new mail is performed
   ** while the mailbox is open.
   */
+  { "clear_on_quit",    DT_BOOL, R_NONE, {.l=OPTCLEARONQUIT}, {.l=0} },
+  /*
+  ** .pp
+  ** When this variable is \fIset\fP, Mutt will clear the terminal screen when
+  ** quitting.
+  */
   { "collapse_unread", DT_BOOL, R_NONE, {.l=OPTCOLLAPSEUNREAD}, {.l=1} },
   /*
   ** .pp
diff --git a/main.c b/main.c
index 3fd930b6..d17aa2f4 100644
--- a/main.c
+++ b/main.c
@@ -1408,6 +1408,10 @@ cleanup_and_exit:
   mutt_free_windows ();
   mutt_buffer_pool_free ();
   if (!option (OPTNOCURSES))
+  {
+    if (option(OPTCLEARONQUIT))
+      clear();
     mutt_endwin (exit_endwin_msg);
+  }
   exit (exit_code);
 }
diff --git a/mutt.h b/mutt.h
index e4b88788..065ed0d7 100644
--- a/mutt.h
+++ b/mutt.h
@@ -411,6 +411,7 @@ enum
   OPTBROWSERSTICKYCURSOR,
   OPTCHECKMBOXSIZE,
   OPTCHECKNEW,
+  OPTCLEARONQUIT,
   OPTCOLLAPSEUNREAD,
   OPTCOMPOSECONFIRMDETACH,
   OPTCONFIRMAPPEND,
-- 
2.32.0

Reply via email to