/* Draw formated compose status line */
if (menu->redraw & REDRAW_STATUS) {
compose_status_line (buf, sizeof (buf), menu, NONULL (ComposeFormat));
- CLEARLINE(main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2);
+ CLEARLINE(main_w, 0);
SETCOLOR(main_w, MT_COLOR_STATUS);
- wmove (main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0);
+ wmove (main_w, 0, 0);
wprintw (main_w, "%-*.*s", getmaxx(main_w), getmaxx(main_w), buf);
SETCOLOR(main_w, MT_COLOR_NORMAL);
menu->redraw &= ~REDRAW_STATUS;
hash_map (ConfigOptions, mutt_restore_default, 0);
CurrentMenu = MENU_MAIN;
-
-#ifdef HAVE_GETSID
- /* Unset suspend by default if we're the session leader */
- if (getsid (0) == getpid ())
- unset_option (OPTSUSPEND);
-#endif
-
mutt_init_history ();
if (!Muttrc) {
** Controls whether 8-bit data is converted to 7-bit using either
** \fTquoted-printable\fP or \fTbase64\fP encoding when sending mail.
*/
- {"allow_ansi", DT_BOOL, R_NONE, OPTALLOWANSI, "no" },
- /*
- ** .pp
- ** Controls whether ANSI color codes in messages (and color tags in
- ** rich text messages) are to be interpreted.
- ** Messages containing these codes are rare, but if this option is set,
- ** their text will be colored accordingly. Note that this may override
- ** your color choices, and even present a security problem, since a
- ** message could include a line like ``\fT[-- PGP output follows ...\fP" and
- ** give it the same color as your attachment color.
- */
{"askbcc", DT_BOOL, R_NONE, OPTASKBCC, "no" },
/*
** .pp
** This variable controls the number of lines of context that are given
** when scrolling through menus. (Similar to ``$$pager_context''.)
*/
- {"menu_move_off", DT_BOOL, R_NONE, OPTMENUMOVEOFF, "yes" },
- /*
- ** .pp
- ** When \fIunset\fP, the bottom entry of menus will never scroll up past
- ** the bottom of the screen, unless there are less entries than lines.
- ** When \fIset\fP, the bottom entry may move off the bottom.
- */
- {"menu_scroll", DT_BOOL, R_NONE, OPTMENUSCROLL, "no" },
- /*
- ** .pp
- ** When \fIset\fP, menus will be scrolled up or down one line when you
- ** attempt to move across a screen boundary. If \fIunset\fP, the screen
- ** is cleared and the next or previous page of the menu is displayed
- ** (useful for slow links to avoid many redraws).
- */
{"mh_purge", DT_BOOL, R_NONE, OPTMHPURGE, "no" },
/*
** .pp
** .pp
** Also see the ``$$write_inc'' variable.
*/
- {"read_only", DT_BOOL, R_NONE, OPTREADONLY, "no" },
- /*
- ** .pp
- ** If set, all folders are opened in read-only mode.
- */
{"realname", DT_STR, R_BOTH, UL &Realname, "" },
/*
** .pp
** and replying. The default value corresponds to the English ``Re:'' and
** the German ``Aw:''.
*/
- {"reply_self", DT_BOOL, R_NONE, OPTREPLYSELF, "no" },
- /*
- ** .pp
- ** If \fIunset\fP and you are replying to a message sent by you, Madmutt will
- ** assume that you want to reply to the recipients of that message rather
- ** than to yourself.
- */
{"reply_to", DT_QUAD, R_NONE, OPT_REPLYTO, "ask-yes" },
/*
** .pp
** will replace any dots in the expansion by underscores. This might be helpful
** with IMAP folders that don't like dots in folder names.
*/
- {"status_on_top", DT_BOOL, R_BOTH, OPTSTATUSONTOP, "no" },
- /*
- ** .pp
- ** Setting this variable causes the ``status bar'' to be displayed on
- ** the first line of the screen rather than near the bottom.
- */
{"strict_mailto", DT_BOOL, R_NONE, OPTSTRICTMAILTO, "yes" },
/*
**
** i.e. a space will be inserted between the quote characters and the actual
** text.
*/
- {"suspend", DT_BOOL, R_NONE, OPTSUSPEND, "yes" },
- /*
- ** .pp
- ** When \fIunset\fP, Madmutt won't stop when the user presses the terminal's
- ** \fIsusp\fP key, usually \fTCTRL+Z\fP. This is useful if you run Madmutt
- ** inside an xterm using a command like ``\fTxterm -e madmutt\fP.''
- */
{"text_flowed", DT_BOOL, R_NONE, OPTTEXTFLOWED, "no" },
/*
** .pp
** This variable only affects decoding.
*/
#endif /* HAVE_LIBIDN */
- {"use_ipv6", DT_BOOL, R_NONE, OPTUSEIPV6, "yes" },
- /*
- ** .pp
- ** When \fIset\fP, Madmutt will look for IPv6 addresses of hosts it tries to
- ** contact. If this option is \fIunset\fP, Madmutt will restrict itself to IPv4 addresses.
- ** Normally, the default should work.
- */
{"agent_string", DT_BOOL, R_NONE, OPTXMAILER, "yes" },
/*
** .pp
switch (sig) {
case SIGTSTP: /* user requested a suspend */
- if (!option (OPTSUSPEND))
- break;
IsEndwin = isendwin ();
curs_set (1);
if (!IsEndwin)
/* we accept v4 or v6 STREAM sockets */
p_clear(&hints, 1);
- if (option (OPTUSEIPV6))
- hints.ai_family = AF_UNSPEC;
- else
- hints.ai_family = AF_INET;
-
+ hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
snprintf (port, sizeof (port), "%d", conn->account.port);
if (menu->redraw & REDRAW_STATUS) {
menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
- CLEARLINE(main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2);
+ CLEARLINE(main_w, 0);
SETCOLOR(main_w, MT_COLOR_STATUS);
BKGDSET(main_w, MT_COLOR_STATUS);
- wmove(main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0);
+ wmove(main_w, 0, 0);
mutt_paddstr (main_w, getmaxx(main_w), buf);
SETCOLOR(main_w, MT_COLOR_NORMAL);
BKGDSET(main_w, MT_COLOR_NORMAL);
case OP_MAIN_CHANGE_GROUP:
case OP_MAIN_CHANGE_GROUP_READONLY:
#endif
- if (attach_msg || option (OPTREADONLY) ||
+ if (attach_msg ||
#ifdef USE_NNTP
op == OP_MAIN_CHANGE_GROUP_READONLY ||
#endif
wclrtobot (main_w);
SETCOLOR(main_w, MT_COLOR_STATUS);
- wmove (main_w, option (OPTSTATUSONTOP) ? LINES - 2 : 0, 0);
+ wmove (main_w, LINES - 2, 0);
mutt_paddstr (main_w, getmaxx(main_w), "");
SETCOLOR(main_w, MT_COLOR_NORMAL);
menu->offset = 1;
snprintf (buf, sizeof (buf), M_MODEFMT, menu->title);
SETCOLOR(main_w, MT_COLOR_STATUS);
- wmove (main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0);
+ wmove (main_w, 0, 0);
mutt_paddstr (main_w, getmaxx(main_w), buf);
SETCOLOR(main_w, MT_COLOR_NORMAL);
menu->redraw &= ~REDRAW_STATUS;
int c = MIN (MenuContext, menu->pagelen / 2);
int old_top = menu->top;
- if (!option (OPTMENUMOVEOFF) && menu->max <= menu->pagelen) { /* less entries than lines */
- if (menu->top != 0) {
- menu->top = 0;
- set_option (OPTNEEDREDRAW);
- }
+ if ((menu->pagelen <= 0) || (c < MenuContext)) {
+ if (menu->current < menu->top + c)
+ menu->top = menu->current - c;
+ else if (menu->current >= menu->top + menu->pagelen - c)
+ menu->top = menu->current - menu->pagelen + c + 1;
} else {
- if (option (OPTMENUSCROLL) || (menu->pagelen <= 0) || (c < MenuContext)) {
- if (menu->current < menu->top + c)
- menu->top = menu->current - c;
- else if (menu->current >= menu->top + menu->pagelen - c)
- menu->top = menu->current - menu->pagelen + c + 1;
- } else {
- if (menu->current < menu->top + c)
- menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - menu->current) / (menu->pagelen - c)) - c;
- else if ((menu->current >= menu->top + menu->pagelen - c))
- menu->top += (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c;
- }
+ if (menu->current < menu->top + c)
+ menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - menu->current) / (menu->pagelen - c)) - c;
+ else if ((menu->current >= menu->top + menu->pagelen - c))
+ menu->top += (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c;
}
- if (!option (OPTMENUMOVEOFF)) /* make entries stick to bottom */
- menu->top = MIN (menu->top, menu->max - menu->pagelen);
menu->top = MAX (menu->top, 0);
if (menu->top != old_top)
if (menu->max) {
int c = MIN (MenuContext, menu->pagelen / 2);
- if (menu->top + 1 < menu->max - c && (option (OPTMENUMOVEOFF)
- || (menu->max > menu->pagelen
- && menu->top <
- menu->max - menu->pagelen))) {
+ if (menu->top + 1 < menu->max - c) {
menu->top++;
if (menu->current < menu->top + c && menu->current < menu->max - 1)
menu->current++;
menu->redraw = REDRAW_INDEX;
- }
- else
+ } else {
mutt_error _("You cannot scroll down farther.");
- }
- else
+ }
+ } else {
mutt_error _("No entries.");
+ }
}
void menu_prev_line (MUTTMENU * menu)
menu->top += jumplen;
/* jumped too long? */
- if ((neg || !option (OPTMENUMOVEOFF)) && DIRECTION * menu->top > tmp)
+ if (neg && DIRECTION * menu->top > tmp)
menu->top = tmp;
/* need to move the cursor? */
mutt_folder_hook (folder);
- if ((Context = mx_open_mailbox (folder, ((flags & M_RO)
- || option (OPTREADONLY)) ?
- M_READONLY : 0, NULL))
- || !explicit_folder) {
+ if ((Context = mx_open_mailbox(folder, (flags & M_RO) ? M_READONLY : 0,
+ NULL)) || !explicit_folder)
+ {
mutt_index_menu ();
if (option (OPTXTERMSETTITLES))
printf("\033]2;%s\007", NONULL(XtermLeave));
/* boolean vars */
enum {
OPTALLOW8BIT,
- OPTALLOWANSI,
OPTASKBCC,
OPTASKCC,
OPTASKFOLLOWUP,
OPTMARKERS,
OPTMARKOLD,
OPTMBOXPANE,
- OPTMENUSCROLL, /* scroll menu instead of implicit next-page */
- OPTMENUMOVEOFF,
OPTMETOO,
OPTMHPURGE,
OPTMIMEFORWDECODE,
OPTPROMPTAFTER,
OPTQUOTEEMPTY,
OPTQUOTEQUOTED,
- OPTREADONLY,
- OPTREPLYSELF,
OPTRESOLVE,
OPTREVALIAS,
OPTREVNAME,
OPTREVREAL,
OPTSIGDASHES,
OPTSORTRE,
- OPTSPAMSEP,
- OPTSTATUSONTOP,
OPTSTRICTMAILTO,
OPTSTRICTTHREADS,
OPTSTRIPWAS,
OPTSTUFFQUOTED,
- OPTSUSPEND,
OPTTEXTFLOWED,
OPTTHOROUGHSRC,
OPTTHREADRECEIVED,
#ifdef HAVE_LIBIDN
OPTUSEIDN,
#endif
- OPTUSEIPV6,
OPTWAITKEY,
OPTWEED,
OPTWRAP,
OPTMAX
};
-#define mutt_bit_alloc(n) p_new(char, (n + 7) / 8)
-#define mutt_bit_set(v,n) v[n/8] |= (1 << (n % 8))
-#define mutt_bit_unset(v,n) v[n/8] &= ~(1 << (n % 8))
-#define mutt_bit_toggle(v,n) v[n/8] ^= (1 << (n % 8))
-#define mutt_bit_isset(v,n) (v[n/8] & (1 << (n % 8)))
+#define mutt_bit_set(v,n) (v[n/8] |= (1 << (n % 8)))
+#define mutt_bit_unset(v,n) (v[n/8] &= ~(1 << (n % 8)))
+#define mutt_bit_toggle(v,n) (v[n/8] ^= (1 << (n % 8)))
+#define mutt_bit_isset(v,n) (v[n/8] & (1 << (n % 8)))
-#define set_option(x) mutt_bit_set(Options,x)
-#define unset_option(x) mutt_bit_unset(Options,x)
+#define set_option(x) mutt_bit_set(Options,x)
+#define unset_option(x) mutt_bit_unset(Options,x)
#define toggle_option(x) mutt_bit_toggle(Options,x)
-#define option(x) mutt_bit_isset(Options,x)
+#define option(x) mutt_bit_isset(Options,x)
void mutt_init (int, string_list_t *);
return (int)(*p - *q);
}
-static int grok_ansi (unsigned char *buf, int pos, ansi_attr * a)
-{
- int x = pos;
-
- while (isdigit (buf[x]) || buf[x] == ';')
- x++;
-
- /* Character Attributes */
- if (option (OPTALLOWANSI) && a != NULL && buf[x] == 'm') {
- if (pos == x) {
- if (a->pair != -1)
- mutt_free_color (a->fg, a->bg);
- a->attr = ANSI_OFF;
- a->pair = -1;
- }
- a->bg = -2;
- a->fg = -2;
- while (pos < x) {
- if (buf[pos] == '1' && (pos + 1 == x || buf[pos + 1] == ';')) {
- a->attr |= ANSI_BOLD;
- pos += 2;
- }
- else if (buf[pos] == '4' && (pos + 1 == x || buf[pos + 1] == ';')) {
- a->attr |= ANSI_UNDERLINE;
- pos += 2;
- }
- else if (buf[pos] == '5' && (pos + 1 == x || buf[pos + 1] == ';')) {
- a->attr |= ANSI_BLINK;
- pos += 2;
- }
- else if (buf[pos] == '7' && (pos + 1 == x || buf[pos + 1] == ';')) {
- a->attr |= ANSI_REVERSE;
- pos += 2;
- }
- else if (buf[pos] == '0' && (pos + 1 == x || buf[pos + 1] == ';')) {
- a->bg = -2;
- a->fg = -2;
- pos += 2;
- }
- else if (buf[pos] == '3' && isdigit (buf[pos + 1])) {
- if (a->pair != -1)
- mutt_free_color (a->fg, a->bg);
- a->pair = -1;
- a->attr |= ANSI_COLOR;
- if (buf[pos + 1] != '9')
- a->fg = buf[pos + 1] - '0';
- pos += 3;
- }
- else if (buf[pos] == '4' && isdigit (buf[pos + 1])) {
- if (a->pair != -1)
- mutt_free_color (a->fg, a->bg);
- a->pair = -1;
- a->attr |= ANSI_COLOR;
- if (buf[pos + 1] != '9')
- a->bg = buf[pos + 1] - '0';
- pos += 3;
- } else {
- while (pos < x && buf[pos] != ';')
- pos++;
- pos++;
- }
- }
- }
- pos = x;
- return pos;
-}
-
/* trim tail of buf so that it contains complete multibyte characters */
static int trim_incomplete_mbyte(unsigned char *buf, size_t len) {
mbstate_t mbstate;
for (ch = 0, vch = 0; ch < cnt; ch += k, vch += k) {
/* Handle ANSI sequences */
while (cnt - ch >= 2 && buf[ch] == '\033' && buf[ch + 1] == '[' &&
- is_ansi (buf + ch + 2))
- ch = grok_ansi (buf, ch + 2, pa) + 1;
+ is_ansi (buf + ch + 2)) {
+ while (isdigit(buf[ch]) || buf[ch] == ';')
+ ch++;
+ }
while (cnt - ch >= 2 && buf[ch] == '\033' && buf[ch + 1] == ']' &&
check_attachment_marker ((char *) buf + ch) == 0) {
indicator = indexlen / 3;
- if (option (OPTSTATUSONTOP)) {
- indexoffset = 0;
- statusoffset = IsHeader (extra) ? indexlen : 0;
- bodyoffset = statusoffset + 1;
- helpoffset = LINES - 2;
- bodylen = helpoffset - bodyoffset;
- } else {
- helpoffset = 0;
- indexoffset = 1;
- statusoffset = LINES - 2;
- bodyoffset = indexoffset + (IsHeader (extra) ? indexlen : 0);
- bodylen = statusoffset - bodyoffset;
- }
+ indexoffset = 0;
+ statusoffset = IsHeader (extra) ? indexlen : 0;
+ bodyoffset = statusoffset + 1;
+ helpoffset = LINES - 2;
+ bodylen = helpoffset - bodyoffset;
SETCOLOR(main_w, MT_COLOR_STATUS);
wmove(main_w, helpoffset, 0);
}
SETCOLOR(main_w, MT_COLOR_NORMAL);
- pager_index->offset = indexoffset + (option (OPTSTATUSONTOP) ? 1 : 0);
+ pager_index->offset = indexoffset + 1;
pager_index->pagelen = indexlen - 1;
sidebar_draw ();
/* print out the pager_index status bar */
menu_status_line (buffer, sizeof (buffer), pager_index, NONULL (Status));
- wmove(main_w, indexoffset + (option(OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0);
+ wmove(main_w, indexoffset + 0, 0);
SETCOLOR(main_w, MT_COLOR_STATUS);
BKGDSET(main_w, MT_COLOR_STATUS);
mutt_paddstr(main_w, getmaxx(main_w), buffer);
}
}
- if (!option (OPTREPLYSELF) && mutt_addr_is_user (env->from)) {
+ if (mutt_addr_is_user(env->from)) {
/* mail is from the user, assume replying to recipients */
address_list_append(to, address_list_dup(env->to));
}