if test "$ac_cv_func_decl_resizeterm" = yes; then
MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS resize.o"
fi
+ AC_CHECK_FUNCS([use_extended_names])
LIBS="$old_LIBS"
])
extern size_t UngetCount;
+/* de facto standard escapes for tsl/fsl */
+static char *tsl = "\033]0;";
+static char *fsl = "\007";
+
+/* terminal status capability check. terminfo must have been initialized. */
+short mutt_ts_capability(void)
+{
+ char *term = getenv("TERM");
+ char *tcaps;
+ int tcapi;
+ char **termp;
+ char *known[] = {
+ "color-xterm",
+ "cygwin",
+ "eterm",
+ "kterm",
+ "nxterm",
+ "putty",
+ "rxvt",
+ "screen",
+ "xterm",
+ NULL
+ };
+
+ /* If tsl is set, then terminfo says that status lines work. */
+ tcaps = tigetstr("tsl");
+ if (tcaps && tcaps != (char *)-1 && *tcaps)
+ {
+ /* update the static defns of tsl/fsl from terminfo */
+ tsl = safe_strdup(tcaps);
+
+ tcaps = tigetstr("fsl");
+ if (tcaps && tcaps != (char *)-1 && *tcaps)
+ fsl = safe_strdup(tcaps);
+
+ return 1;
+ }
+
+ /* If XT (boolean) is set, then this terminal supports the standard escape. */
+ /* Beware: tigetflag returns -1 if XT is invalid or not a boolean. */
+#ifdef HAVE_USE_EXTENDED_NAMES
+ use_extended_names (TRUE);
+ tcapi = tigetflag("XT");
+ if (tcapi == 1)
+ return 1;
+#endif /* HAVE_USE_EXTENDED_NAMES */
+
+ /* Check term types that are known to support the standard escape without
+ * necessarily asserting it in terminfo. */
+ for (termp = known; termp; termp++)
+ {
+ if (term && *termp && mutt_strncasecmp (term, *termp, strlen(*termp)))
+ return 1;
+ }
+
+ /* not supported */
+ return 0;
+}
+
+void mutt_ts_status(char *str)
+{
+ /* If empty, do not set. To clear, use a single space. */
+ if (str == NULL || *str == '\0')
+ return;
+ fprintf(stderr, "%s%s%s", tsl, str, fsl);
+}
+
+void mutt_ts_icon(char *str)
+{
+ /* If empty, do not set. To clear, use a single space. */
+ if (str == NULL || *str == '\0')
+ return;
+
+ /* icon setting is not supported in terminfo, so hardcode the escape - yuck */
+ fprintf(stderr, "\033]1;%s\007", str);
+}
+
void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num)
{
format_flag flag = M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR | M_FORMAT_INDEX;
mutt_paddstr (COLS, buf);
NORMAL_COLOR;
menu->redraw &= ~REDRAW_STATUS;
+ if (option(OPTTSENABLED) && TSSupported)
+ {
+ menu_status_line (buf, sizeof (buf), menu, NONULL (TSStatusFormat));
+ mutt_ts_status(buf);
+ menu_status_line (buf, sizeof (buf), menu, NONULL (TSIconFormat));
+ mutt_ts_icon(buf);
+ }
}
menu->redraw = 0;
WHERE char *Status;
WHERE char *Tempdir;
WHERE char *Tochars;
+WHERE char *TSStatusFormat;
+WHERE char *TSIconFormat;
+WHERE short TSSupported;
WHERE char *Username;
WHERE char *Visual;
** by \fIyou\fP. The sixth character is used to indicate when a mail
** was sent to a mailing-list you subscribe to.
*/
+ {"ts_icon_format", DT_STR, R_BOTH, UL &TSIconFormat, UL "M%?n?AIL&ail?"},
+ /*
+ ** .pp
+ ** Controls the format of the icon title, as long as ``$$ts_enabled'' is set.
+ ** This string is identical in formatting to the one used by
+ ** ``$$status_format''.
+ */
+ {"ts_enabled", DT_BOOL, R_BOTH, OPTTSENABLED, 0},
+ /* The default must be off to force in the validity checking. */
+ /*
+ ** .pp
+ ** Controls whether mutt tries to set the terminal status line and icon name.
+ ** Most terminal emulators emulate the status line in the window title.
+ */
+ {"ts_status_format", DT_STR, R_BOTH, UL &TSStatusFormat, UL "Mutt with %?m?%m messages&no messages?%?n? [%n NEW]?"},
+ /*
+ ** .pp
+ ** Controls the format of the terminal status line (or window title),
+ ** provided that ``$$ts_enabled'' has been set. This string is identical in
+ ** formatting to the one used by ``$$status_format''.
+ */
#ifdef USE_SOCKET
{ "tunnel", DT_STR, R_NONE, UL &Tunnel, UL 0 },
/*
** Also see the $$read_inc, $$net_inc and $$time_inc variables and the
** ``$tuning'' section of the manual for performance considerations.
*/
+ {"xterm_icon", DT_SYN, R_NONE, UL "ts_icon_format", 0 },
+ /*
+ */
+ {"xterm_title", DT_SYN, R_NONE, UL "ts_status_format", 0 },
+ /*
+ */
+ {"xterm_set_titles", DT_SYN, R_NONE, UL "ts_enabled", 0 },
+ /*
+ */
/*--*/
{ NULL, 0, 0, 0, 0 }
};
if (!option (OPTNOCURSES))
start_curses ();
+ /* check whether terminal status is supported (must follow curses init) */
+ TSSupported = mutt_ts_capability();
+
/* set defaults and read init files */
mutt_init (flags & M_NOSYSRC, commands);
mutt_free_list (&commands);
OPTTHOROUGHSRC,
OPTTHREADRECEIVED,
OPTTILDE,
+ OPTTSENABLED,
OPTUNCOLLAPSEJUMP,
OPTUSE8BITMIME,
OPTUSEDOMAIN,
void menu_current_bottom (MUTTMENU *);
void menu_check_recenter (MUTTMENU *);
void menu_status_line (char *, size_t, MUTTMENU *, const char *);
+short mutt_ts_capability (void);
+void mutt_ts_status (char *);
+void mutt_ts_icon (char *);
MUTTMENU *mutt_new_menu (int);
void mutt_menuDestroy (MUTTMENU **);
mutt_paddstr (COLS, bn);
}
NORMAL_COLOR;
+ if (option(OPTTSENABLED) && TSSupported)
+ {
+ menu_status_line (buffer, sizeof (buffer), index, NONULL (TSStatusFormat));
+ mutt_ts_status(buffer);
+ menu_status_line (buffer, sizeof (buffer), index, NONULL (TSIconFormat));
+ mutt_ts_icon(buffer);
+ }
}
if ((redraw & REDRAW_INDEX) && index)
void mutt_stamp_attachment (BODY *a);
void mutt_tabs_to_spaces (char *);
void mutt_tag_set_flag (int, int);
+short mutt_ts_capability (void);
void mutt_unblock_signals (void);
void mutt_unblock_signals_system (int);
void mutt_update_encoding (BODY *a);
break;
case 'P':
+ if (!menu)
+ break;
if (menu->top + menu->pagelen >= menu->max)
cp = menu->top ? "end" : "all";
else