Last version (I'd made keymap.c diff in the opposite way).

The *good news* is the send_charset error wasn't due to my patches but
some config option I'm missing.

Here you are:


--- mutt-1.7.2/mutt.h   Mon Dec  5 00:46:59 2016
+++ mutt-1.7.2-modified/mutt.h  Sat Feb 25 23:12:19 2017
@@ -340,6 +340,7 @@ enum
   OPTEDITHDRS,
   OPTENCODEFROM,
   OPTENVFROM,
+  OPTESCKEYABORTS,
   OPTFASTREPLY,
   OPTFCCCLEAR,
   OPTFOLLOWUPTO,


--- mutt-1.7.2/curs_lib.c       Mon Dec  5 00:46:59 2016
+++ mutt-1.7.2-modified/curs_lib.c      Sat Feb 25 23:30:31 2017
@@ -148,7 +148,10 @@ event_t mutt_getch (void)
 
   ret.ch = ch;
   ret.op = 0;
-  return (ch == ctrl ('G') ? err : ret);
+  if (option (OPTESCKEYABORTS))
+    return (ch == '\033' ? err : ret);
+  else
+    return (ch == ctrl ('G') ? err : ret);
 }
 
 int _mutt_get_field (const char *field, char *buf, size_t buflen, int 
complete, int multiple, char ***files, int *numfiles)


--- mutt-1.7.2/keymap.c Mon Dec  5 00:46:59 2016
+++ mutt-1.7.2-modified/keymap.c        Sat Feb 25 14:47:29 2017
@@ -1133,16 +1133,32 @@ void mutt_what_key (void)
 {
   int ch;
 
-  mutt_window_mvprintw (MuttMessageWindow, 0, 0, _("Enter keys (^G to abort): 
"));
-  do {
-    ch = getch();
-    if (ch != ERR && ch != ctrl ('G'))
-    {
-      mutt_message(_("Char = %s, Octal = %o, Decimal = %d"),
-              km_keyname(ch), ch, ch);
+  if (option (OPTESCKEYABORTS))
+  {
+    mutt_window_mvprintw (MuttMessageWindow, 0, 0, _("Enter keys (ESC to 
abort): "));
+    do {
+      ch = getch();
+      if (ch != ERR && ch != '\033')
+      {
+        mutt_message(_("Char = %s, Octal = %o, Decimal = %d"),
+              km_keyname(ch), ch, ch);
+      }
     }
+    while (ch != ERR && ch != '\033');
   }
-  while (ch != ERR && ch != ctrl ('G'));
+  else
+  {
+    mutt_window_mvprintw (MuttMessageWindow, 0, 0, _("Enter keys (^G to 
abort): "));
+    do {
+      ch = getch();
+      if (ch != ERR && ch != ctrl ('G'))
+      {
+        mutt_message(_("Char = %s, Octal = %o, Decimal = %d"),
+              km_keyname(ch), ch, ch);
+      }
+    }
+    while (ch != ERR && ch != ctrl ('G'));
+  }
 
   mutt_flushinp();
   mutt_clear_error();


--- mutt-1.7.2/init.h   Mon Dec  5 00:46:59 2016
+++ mutt-1.7.2-modified/init.h  Sat Feb 25 23:36:57 2017
@@ -762,6 +762,14 @@ struct option_t MuttVars[] = {
   ** .pp
   ** Escape character to use for functions in the built-in editor.
   */
+  { "esc_key_aborts",  DT_BOOL, R_NONE, OPTESCKEYABORTS, 0 },
+  /*
+  ** .pp
+  ** For vi-like bindings users.  Set this value to ``yes'' to use
+  ** ESC key instead of the default Ctrl-G to abort commands.  Take
+  ** in care some predifined emacs-like Meta prefixed bindings will
+  ** stop working.
+  */
   { "fast_reply",      DT_BOOL, R_NONE, OPTFASTREPLY, 0 },
   /*
   ** .pp


Reply via email to