~kevin8t8/mutt

8914a1ba38ef394db3d89ff8d0e54774ca9dca48 — Kevin McCarthy 6 months ago bbe9bd1
Turn off auto-clear outside of autocrypt initialization.

The auto-clearing code was added in commit 01bc088c, for autocrypt
initial prompting.  It removed having to keep track of every place a
browser or other menu might be displayed and having to remember to
clear it out.

However, clearing when mutt exits is a change of behavior for those
who have turned off alternative screens.
3 files changed, 18 insertions(+), 2 deletions(-)

M autocrypt/autocrypt.c
M menu.c
M mutt.h
M autocrypt/autocrypt.c => autocrypt/autocrypt.c +7 -0
@@ 80,6 80,11 @@ int mutt_autocrypt_init (int can_create)
    return -1;

  set_option (OPTIGNOREMACROEVENTS);
  /* The init process can display menus at various points
   * (e.g. browser, pgp key selection).  This allows the screen to be
   * autocleared after each menu, so the subsequent prompts can be
   * read. */
  set_option (OPTMENUPOPCLEARSCREEN);

  if (autocrypt_dir_init (can_create))
    goto bail;


@@ 91,11 96,13 @@ int mutt_autocrypt_init (int can_create)
    goto bail;

  unset_option (OPTIGNOREMACROEVENTS);
  unset_option (OPTMENUPOPCLEARSCREEN);

  return 0;

bail:
  unset_option (OPTIGNOREMACROEVENTS);
  unset_option (OPTMENUPOPCLEARSCREEN);
  unset_option (OPTAUTOCRYPT);
  mutt_autocrypt_db_close ();
  return -1;

M menu.c => menu.c +10 -2
@@ 789,8 789,16 @@ void mutt_pop_current_menu (MUTTMENU *menu)
  else
  {
    CurrentMenu = MENU_MAIN;
    move (0, 0);
    clrtobot ();
    /* Clearing when Mutt exits would be an annoying change in
     * behavior for those who have disabled alternative screens.  The
     * option is currently set by autocrypt initialization which mixes
     * menus and prompts outside of the normal menu system state.
     */
    if (option (OPTMENUPOPCLEARSCREEN))
    {
      move (0, 0);
      clrtobot ();
    }
  }
}


M mutt.h => mutt.h +1 -0
@@ 617,6 617,7 @@ enum
  OPTDONTHANDLEPGPKEYS,	/* (pseudo) used to extract PGP keys */
  OPTIGNOREMACROEVENTS, /* (pseudo) don't process macro/push/exec events while set */
  OPTAUTOCRYPTGPGME,    /* (pseudo) use Autocrypt context inside crypt-gpgme.c */
  OPTMENUPOPCLEARSCREEN, /* (pseudo) clear the screen when popping the last menu. */

  OPTMAX
};