struct Body *b = mutt_make_file_attach(buf2);
if (b)
{
- mutt_view_attachment(NULL, b, MUTT_VA_REGULAR, NULL, NULL);
+ mutt_view_attachment(NULL, b, MUTT_VA_REGULAR, NULL, NULL, menu->indexwin);
mutt_body_free(&b);
menu->redraw = REDRAW_FULL;
}
mutt_parse_mime_message(m, e);
mutt_message_hook(m, e, MUTT_MESSAGE_HOOK);
+ char columns[16];
+ snprintf(columns, sizeof(columns), "%d", win->cols);
+ mutt_envlist_set("COLUMNS", columns, true);
+
/* see if crypto is needed for this message. if so, we should exit curses */
if ((WithCrypto != 0) && e->security)
{
}
cleanup:
+ mutt_envlist_unset("COLUMNS");
mutt_buffer_pool_release(&tempfile);
return rc;
}
close(fderr);
}
- if (MuttIndexWindow && (MuttIndexWindow->cols > 0))
- {
- char columns[16];
- snprintf(columns, sizeof(columns), "%d", MuttIndexWindow->cols);
- mutt_envlist_set("COLUMNS", columns, true);
- }
-
execle(EXEC_SHELL, "sh", "-c", cmd, NULL, mutt_envlist_getlist());
_exit(127);
}
#include "globals.h"
#include "handler.h"
#include "mailcap.h"
+#include "mutt_window.h"
#include "muttlib.h"
#include "mx.h"
#include "ncrypt/ncrypt.h"
* @param mode How the attachment should be viewed, see #ViewAttachMode
* @param e Current Email. Can be NULL
* @param actx Attachment context
+ * @param win Window
* @retval 0 If the viewer is run and exited successfully
* @retval -1 Error
* @retval num Return value of mutt_do_pager() when it is used
* exits.
*/
int mutt_view_attachment(FILE *fp, struct Body *a, enum ViewAttachMode mode,
- struct Email *e, struct AttachCtx *actx)
+ struct Email *e, struct AttachCtx *actx, struct MuttWindow *win)
{
bool use_mailcap = false;
bool use_pipe = false;
(mode == MUTT_VA_MAILCAP || (mode == MUTT_VA_REGULAR && mutt_needs_mailcap(a)));
snprintf(type, sizeof(type), "%s/%s", TYPE(a), a->subtype);
+ char columns[16];
+ snprintf(columns, sizeof(columns), "%d", win->cols);
+ mutt_envlist_set("COLUMNS", columns, true);
+
if (use_mailcap)
{
entry = mailcap_entry_new();
pid = mutt_create_filter_fd(mutt_b2s(cmd), NULL, NULL, NULL,
use_pipe ? fd_temp : -1,
use_pager ? fd_pager : -1, -1);
+
if (pid == -1)
{
if (fd_pager != -1)
mutt_buffer_pool_release(&tmpfile);
mutt_buffer_pool_release(&pagerfile);
mutt_buffer_pool_release(&cmd);
+ mutt_envlist_unset("COLUMNS");
return rc;
}
#include <stdio.h>
struct AttachCtx;
-struct Menu;
-struct Email;
struct Body;
+struct Email;
+struct Menu;
+struct MuttWindow;
/**
* enum ViewAttachMode - Options for mutt_view_attachment()
void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag,
struct Body *top);
-int mutt_view_attachment(FILE *fp, struct Body *a, enum ViewAttachMode mode, struct Email *e, struct AttachCtx *actx);
+int mutt_view_attachment(FILE *fp, struct Body *a, enum ViewAttachMode mode, struct Email *e, struct AttachCtx *actx, struct MuttWindow *win);
void mutt_check_lookup_list(struct Body *b, char *type, size_t len);
int mutt_compose_attachment(struct Body *a);
case OP_VIEW_ATTACH:
op = mutt_view_attachment(CUR_ATTACH->fp, CUR_ATTACH->content,
- MUTT_VA_REGULAR, e, actx);
+ MUTT_VA_REGULAR, e, actx, menu->indexwin);
break;
case OP_NEXT_ENTRY:
switch (op)
{
case OP_ATTACH_VIEW_MAILCAP:
- mutt_view_attachment(CUR_ATTACH->fp, CUR_ATTACH->content, MUTT_VA_MAILCAP, e, actx);
+ mutt_view_attachment(CUR_ATTACH->fp, CUR_ATTACH->content,
+ MUTT_VA_MAILCAP, e, actx, menu->indexwin);
menu->redraw = REDRAW_FULL;
break;
case OP_ATTACH_VIEW_TEXT:
- mutt_view_attachment(CUR_ATTACH->fp, CUR_ATTACH->content, MUTT_VA_AS_TEXT, e, actx);
+ mutt_view_attachment(CUR_ATTACH->fp, CUR_ATTACH->content,
+ MUTT_VA_AS_TEXT, e, actx, menu->indexwin);
menu->redraw = REDRAW_FULL;
break;