summaryrefslogtreecommitdiffstats
path: root/curs_main.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2020-01-28 15:51:57 -0800
committerKevin McCarthy <kevin@8t8.us>2020-02-29 19:15:09 -0800
commit4af5c934cdcff0366580f96e7bc7ac1f41721a97 (patch)
treebfc25b0a99da8d6161f319effece7298f067d8ed /curs_main.c
parent9defa202e35a2445405170255c95d3682ae5b065 (diff)
Enable backgrounding a single <mail> function.
Backgrounding exits to the index menu. Re-invoking <mail> will resume the backgrounded session, if one exists, otherwise start a new session. This is just to get basic support going. Multiple background edits, a landing page, a background compose menu list will be added next.
Diffstat (limited to 'curs_main.c')
-rw-r--r--curs_main.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/curs_main.c b/curs_main.c
index bc098150..e3e584c8 100644
--- a/curs_main.c
+++ b/curs_main.c
@@ -29,6 +29,7 @@
#include "buffy.h"
#include "mx.h"
#include "send.h"
+#include "background.h"
#ifdef USE_SIDEBAR
#include "sidebar.h"
@@ -2239,7 +2240,24 @@ int mutt_index_menu (void)
case OP_MAIL:
CHECK_ATTACH;
- mutt_send_message (0, NULL, NULL, Context, NULL);
+ if (BackgroundProcess)
+ {
+ SEND_CONTEXT *sctx = BackgroundProcess;
+ BackgroundProcess = NULL;
+ /* this is a quick hack for now */
+ mutt_message _("Waiting for editor to exit");
+ waitpid (sctx->background_pid, NULL, 0);
+ mutt_clear_error ();
+
+ if (mutt_send_message_resume (sctx) == 2)
+ mutt_message _("Editing backgrounded. Hit m to restart");
+ }
+ else
+ {
+ if (mutt_send_message (SENDBACKGROUNDEDIT, NULL, NULL,
+ Context, NULL) == 2)
+ mutt_message _("Editing backgrounded. Hit m to restart");
+ }
menu->redraw = REDRAW_FULL;
break;