Move the rest of mutt "things" into a window as well.
authorPierre Habouzit <madcoder@debian.org>
Mon, 13 Aug 2007 22:45:45 +0000 (00:45 +0200)
committerPierre Habouzit <madcoder@debian.org>
Mon, 13 Aug 2007 22:45:45 +0000 (00:45 +0200)
  Only the input line remains in stdscr ... for now.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
28 files changed:
alias.cpkg
browser.c
commands.c
compose.c
crypt.cpkg
flags.c
handler.c
help.c
init.c
init.h
keymap.c
lib-mime/rfc3676.c
lib-sys/mutt_signal.c
lib-ui/color.c
lib-ui/curs_lib.c
lib-ui/curs_main.c
lib-ui/curses.h
lib-ui/enter.c
lib-ui/hdrline.c
lib-ui/layout.c
lib-ui/menu.c
lib-ui/sidebar.c
lib-ui/status.c
mutt.h
muttlib.c
pager.c
recvattach.c
recvcmd.c

index cca09b6..10e2d8c 100644 (file)
@@ -607,7 +607,7 @@ alias_format_str(char *dest, ssize_t destlen, char op, const char *src,
 
 static void alias_entry(char *s, ssize_t slen, MUTTMENU *m, int num)
 {
 
 static void alias_entry(char *s, ssize_t slen, MUTTMENU *m, int num)
 {
-    m_strformat(s, slen, COLS - SW, MAlias.alias_format, alias_format_str,
+    m_strformat(s, slen, getmaxx(main_w), MAlias.alias_format, alias_format_str,
                 ((alias_t **)m->data)[num], 0);
 }
 
                 ((alias_t **)m->data)[num], 0);
 }
 
index f17b1f5..f001c3d 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -612,11 +612,11 @@ static void folder_entry (char *s, ssize_t slen, MUTTMENU * menu, int num)
 
 #ifdef USE_NNTP
   if (option (OPTNEWS))
 
 #ifdef USE_NNTP
   if (option (OPTNEWS))
-    m_strformat(s, slen, COLS - SW, GroupFormat, newsgroup_format_str,
+    m_strformat(s, slen, getmaxx(main_w), GroupFormat, newsgroup_format_str,
                 &folder, 0);
   else
 #endif
                 &folder, 0);
   else
 #endif
-    m_strformat(s, slen, COLS - SW, FolderFormat, folder_format_str,
+    m_strformat(s, slen, getmaxx(main_w), FolderFormat, folder_format_str,
                 &folder, 0);
 }
 
                 &folder, 0);
 }
 
index 3870aa8..ca0efcc 100644 (file)
@@ -209,9 +209,10 @@ void ci_bounce_message (HEADER * h, int *redraw)
             buf);
 
 #define extra_space (15 + 7 + 2)
             buf);
 
 #define extra_space (15 + 7 + 2)
-  if (m_strwidth(prompt) > COLS - extra_space) {
-    mutt_format_string(prompt, sizeof(prompt), 0, COLS - extra_space, 0, 0,
-                       prompt, sizeof(prompt), 0);
+  if (m_strwidth(prompt) > getmaxx(main_w) - extra_space) {
+    mutt_format_string(prompt, sizeof(prompt), 0,
+                       getmaxx(main_w) - extra_space, 0, 0, prompt,
+                       sizeof(prompt), 0);
     m_strcat(prompt, sizeof(prompt), "...?");
   } else {
     m_strcat(prompt, sizeof(prompt), "?");
     m_strcat(prompt, sizeof(prompt), "...?");
   } else {
     m_strcat(prompt, sizeof(prompt), "?");
@@ -220,12 +221,12 @@ void ci_bounce_message (HEADER * h, int *redraw)
 
   if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
     address_list_wipe(&adr);
 
   if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
     address_list_wipe(&adr);
-    CLEARLINE (LINES - 1);
+    CLEARLINE(main_w, LINES - 1);
     mutt_message (h ? _("Message not bounced.") : _("Messages not bounced."));
     return;
   }
 
     mutt_message (h ? _("Message not bounced.") : _("Messages not bounced."));
     return;
   }
 
-  CLEARLINE (LINES - 1);
+  CLEARLINE(main_w, LINES - 1);
 
   rc = mutt_bounce_message (NULL, h, adr);
   address_list_wipe(&adr);
 
   rc = mutt_bounce_message (NULL, h, adr);
   address_list_wipe(&adr);
@@ -464,7 +465,7 @@ void mutt_shell_escape (void)
     if (!buf[0])
       m_strcpy(buf, sizeof(buf), mod_core.shell);
     if (buf[0]) {
     if (!buf[0])
       m_strcpy(buf, sizeof(buf), mod_core.shell);
     if (buf[0]) {
-      CLEARLINE (LINES - 1);
+      CLEARLINE(main_w, LINES - 1);
       mutt_endwin (NULL);
       fflush (stdout);
       if (mutt_system (buf) != 0 || option (OPTWAITKEY))
       mutt_endwin (NULL);
       fflush (stdout);
       if (mutt_system (buf) != 0 || option (OPTWAITKEY))
index d23e45f..643268e 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -68,8 +68,7 @@ enum {
 
 #define HDR_XOFFSET     14
 #define TITLE_FMT       "%14s"        /* Used for Prompts, which are ASCII */
 
 #define HDR_XOFFSET     14
 #define TITLE_FMT       "%14s"        /* Used for Prompts, which are ASCII */
-#define SW              (option(OPTMBOXPANE)?SidebarWidth:0)
-#define W               (COLS - HDR_XOFFSET - SW)
+#define W               (getmaxx(main_w) - HDR_XOFFSET)
 
 static const char *Prompts[] = {
     "From: ",
 
 static const char *Prompts[] = {
     "From: ",
@@ -85,7 +84,7 @@ static const char *Prompts[] = {
 };
 
 static void snd_entry (char *b, ssize_t blen, MUTTMENU * menu, int num) {
 };
 
 static void snd_entry (char *b, ssize_t blen, MUTTMENU * menu, int num) {
-  m_strformat(b, blen, COLS - SW, AttachFormat, mutt_attach_fmt,
+  m_strformat(b, blen, getmaxx(main_w), AttachFormat, mutt_attach_fmt,
               ((ATTACHPTR **)menu->data)[num], M_FORMAT_STAT_FILE);
 }
 
               ((ATTACHPTR **)menu->data)[num], M_FORMAT_STAT_FILE);
 }
 
@@ -94,45 +93,45 @@ static void redraw_crypt_lines (HEADER * msg)
   int off = 0;
 
   if (!msg->security)
   int off = 0;
 
   if (!msg->security)
-    mvwaddstr (stdscr, HDR_CRYPT, SW, "    Security: ");
+    mvwaddstr (main_w, HDR_CRYPT, 0, "    Security: ");
   else if (msg->security & APPLICATION_SMIME)
   else if (msg->security & APPLICATION_SMIME)
-    mvwaddstr (stdscr, HDR_CRYPT, SW, "      S/MIME: ");
+    mvwaddstr (main_w, HDR_CRYPT, 0, "      S/MIME: ");
   else if (msg->security & APPLICATION_PGP)
   else if (msg->security & APPLICATION_PGP)
-    mvwaddstr (stdscr, HDR_CRYPT, SW, "         PGP: ");
+    mvwaddstr (main_w, HDR_CRYPT, 0, "         PGP: ");
 
   if ((msg->security & (ENCRYPT | SIGN)) == (ENCRYPT | SIGN))
 
   if ((msg->security & (ENCRYPT | SIGN)) == (ENCRYPT | SIGN))
-    waddstr (stdscr, _("Sign, Encrypt"));
+    waddstr (main_w, _("Sign, Encrypt"));
   else if (msg->security & ENCRYPT)
   else if (msg->security & ENCRYPT)
-    waddstr (stdscr, _("Encrypt"));
+    waddstr (main_w, _("Encrypt"));
   else if (msg->security & SIGN)
   else if (msg->security & SIGN)
-    waddstr (stdscr, _("Sign"));
+    waddstr (main_w, _("Sign"));
   else
   else
-    waddstr (stdscr, _("Clear"));
+    waddstr (main_w, _("Clear"));
 
   if ((msg->security & APPLICATION_PGP)
       && (msg->security & (ENCRYPT | SIGN))) {
     if ((msg->security & INLINE))
 
   if ((msg->security & APPLICATION_PGP)
       && (msg->security & (ENCRYPT | SIGN))) {
     if ((msg->security & INLINE))
-      waddstr (stdscr, _(" (inline)"));
+      waddstr (main_w, _(" (inline)"));
     else
     else
-      waddstr (stdscr, _(" (PGP/MIME)"));
+      waddstr (main_w, _(" (PGP/MIME)"));
   }
   }
-  wclrtoeol (stdscr);
+  wclrtoeol (main_w);
 
 
-  wmove (stdscr, HDR_CRYPTINFO, SW);
-  wclrtoeol (stdscr);
+  wmove (main_w, HDR_CRYPTINFO, 0);
+  wclrtoeol (main_w);
   if (msg->security & APPLICATION_PGP && msg->security & SIGN)
   if (msg->security & APPLICATION_PGP && msg->security & SIGN)
-    wprintw (stdscr, "%s%s", _("     sign as: "),
+    wprintw (main_w, "%s%s", _("     sign as: "),
             PgpSignAs ? PgpSignAs : _("<default>"));
 
   if (msg->security & APPLICATION_SMIME && msg->security & SIGN) {
             PgpSignAs ? PgpSignAs : _("<default>"));
 
   if (msg->security & APPLICATION_SMIME && msg->security & SIGN) {
-    wprintw (stdscr, "%s%s", _("     sign as: "),
+    wprintw (main_w, "%s%s", _("     sign as: "),
             SmimeDefaultKey ? SmimeDefaultKey : _("<default>"));
   }
 
   if ((msg->security & APPLICATION_SMIME)
       && (msg->security & ENCRYPT)
       && SmimeCryptAlg && *SmimeCryptAlg) {
             SmimeDefaultKey ? SmimeDefaultKey : _("<default>"));
   }
 
   if ((msg->security & APPLICATION_SMIME)
       && (msg->security & ENCRYPT)
       && SmimeCryptAlg && *SmimeCryptAlg) {
-    mvwprintw (stdscr, HDR_CRYPTINFO, SW + 40, "%s%s", _("Encrypt with: "),
+    mvwprintw (main_w, HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
               NONULL (SmimeCryptAlg));
     off = 20;
   }
               NONULL (SmimeCryptAlg));
     off = 20;
   }
@@ -173,8 +172,8 @@ static void draw_envelope_addr (int line, address_t * addr)
 
   buf[0] = 0;
   rfc822_addrcat(buf, sizeof (buf), addr, 1);
 
   buf[0] = 0;
   rfc822_addrcat(buf, sizeof (buf), addr, 1);
-  mvwprintw (stdscr, line, SW, TITLE_FMT, Prompts[line - 1]);
-  mutt_paddstr (W, buf);
+  mvwprintw (main_w, line, 0, TITLE_FMT, Prompts[line - 1]);
+  mutt_paddstr (main_w, W, buf);
 }
 
 static void draw_envelope (HEADER * msg, char *fcc)
 }
 
 static void draw_envelope (HEADER * msg, char *fcc)
@@ -188,27 +187,27 @@ static void draw_envelope (HEADER * msg, char *fcc)
     draw_envelope_addr (HDR_BCC, msg->env->bcc);
 #ifdef USE_NNTP
   } else {
     draw_envelope_addr (HDR_BCC, msg->env->bcc);
 #ifdef USE_NNTP
   } else {
-    mvwprintw (stdscr, HDR_TO, SW, TITLE_FMT, Prompts[HDR_NEWSGROUPS - 1]);
-    mutt_paddstr (W, NONULL (msg->env->newsgroups));
-    mvwprintw (stdscr, HDR_CC, SW, TITLE_FMT, Prompts[HDR_FOLLOWUPTO - 1]);
-    mutt_paddstr (W, NONULL (msg->env->followup_to));
+    mvwprintw (main_w, HDR_TO, 0, TITLE_FMT, Prompts[HDR_NEWSGROUPS - 1]);
+    mutt_paddstr (main_w, W, NONULL (msg->env->newsgroups));
+    mvwprintw (main_w, HDR_CC, 0, TITLE_FMT, Prompts[HDR_FOLLOWUPTO - 1]);
+    mutt_paddstr (main_w, W, NONULL (msg->env->followup_to));
   }
 #endif
   }
 #endif
-  mvwprintw (stdscr, HDR_SUBJECT, SW, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
-  mutt_paddstr (W, NONULL (msg->env->subject));
+  mvwprintw (main_w, HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
+  mutt_paddstr (main_w, W, NONULL (msg->env->subject));
   draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
   draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
-  mvwprintw (stdscr, HDR_FCC, SW, TITLE_FMT, Prompts[HDR_FCC - 1]);
-  mutt_paddstr (W, fcc);
+  mvwprintw (main_w, HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]);
+  mutt_paddstr (main_w, W, fcc);
 
   redraw_crypt_lines (msg);
 
 
   redraw_crypt_lines (msg);
 
-  SETCOLOR (MT_COLOR_STATUS);
-  mvwaddstr (stdscr, HDR_ATTACH - 1, SW, _("-- Attachments"));
-  BKGDSET (MT_COLOR_STATUS);
-  wclrtoeol (stdscr);
+  SETCOLOR(main_w, MT_COLOR_STATUS);
+  mvwaddstr (main_w, HDR_ATTACH - 1, 0, _("-- Attachments"));
+  BKGDSET(main_w, MT_COLOR_STATUS);
+  wclrtoeol (main_w);
 
 
-  BKGDSET (MT_COLOR_NORMAL);
-  SETCOLOR (MT_COLOR_NORMAL);
+  BKGDSET(main_w, MT_COLOR_NORMAL);
+  SETCOLOR(main_w, MT_COLOR_NORMAL);
 }
 
 static int edit_address_list (int line, address_t ** addr)
 }
 
 static int edit_address_list (int line, address_t ** addr)
@@ -238,8 +237,8 @@ static int edit_address_list (int line, address_t ** addr)
   /* redraw the expanded list so the user can see the result */
   buf[0] = 0;
   rfc822_addrcat(buf, sizeof (buf), *addr, 1);
   /* redraw the expanded list so the user can see the result */
   buf[0] = 0;
   rfc822_addrcat(buf, sizeof (buf), *addr, 1);
-  wmove (stdscr, line, HDR_XOFFSET + SW);
-  mutt_paddstr (W, buf);
+  wmove (main_w, line, HDR_XOFFSET);
+  mutt_paddstr (main_w, W, buf);
 
   return 0;
 }
 
   return 0;
 }
@@ -394,7 +393,7 @@ static const char *compose_format_str (char *buf, ssize_t buflen, char op,
 static void compose_status_line (char *buf, ssize_t buflen, MUTTMENU * menu,
                                  const char *p)
 {
 static void compose_status_line (char *buf, ssize_t buflen, MUTTMENU * menu,
                                  const char *p)
 {
-    m_strformat(buf, buflen, COLS - SW, p, compose_format_str, menu, 0);
+    m_strformat(buf, buflen, getmaxx(main_w), p, compose_format_str, menu, 0);
 }
 
 /* return values:
 }
 
 /* return values:
@@ -501,10 +500,10 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
           p_delete(&msg->env->newsgroups);
           m_strrtrim(buf);
           msg->env->newsgroups = m_strdup(skipspaces(buf));
           p_delete(&msg->env->newsgroups);
           m_strrtrim(buf);
           msg->env->newsgroups = m_strdup(skipspaces(buf));
-          wmove (stdscr, HDR_TO, HDR_XOFFSET);
-          wclrtoeol (stdscr);
+          wmove (main_w, HDR_TO, HDR_XOFFSET);
+          wclrtoeol (main_w);
           if (msg->env->newsgroups)
           if (msg->env->newsgroups)
-            wprintw (stdscr, "%-*.*s", W, W, msg->env->newsgroups);
+            wprintw (main_w, "%-*.*s", W, W, msg->env->newsgroups);
         }
       }
       break;
         }
       }
       break;
@@ -519,10 +518,10 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
           p_delete(&msg->env->followup_to);
           m_strrtrim(buf);
           msg->env->followup_to = m_strdup(skipspaces(buf));
           p_delete(&msg->env->followup_to);
           m_strrtrim(buf);
           msg->env->followup_to = m_strdup(skipspaces(buf));
-          wmove (stdscr, HDR_CC, HDR_XOFFSET);
-          wclrtoeol (stdscr);
+          wmove (main_w, HDR_CC, HDR_XOFFSET);
+          wclrtoeol (main_w);
           if (msg->env->followup_to)
           if (msg->env->followup_to)
-            wprintw (stdscr, "%-*.*s", W, W, msg->env->followup_to);
+            wprintw (main_w, "%-*.*s", W, W, msg->env->followup_to);
         }
       }
       break;
         }
       }
       break;
@@ -535,10 +534,10 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
         buf[0] = 0;
       if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) {
         m_strreplace(&msg->env->subject, buf);
         buf[0] = 0;
       if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) {
         m_strreplace(&msg->env->subject, buf);
-        wmove (stdscr, HDR_SUBJECT, HDR_XOFFSET + SW);
-        wclrtoeol (stdscr);
+        wmove (main_w, HDR_SUBJECT, HDR_XOFFSET);
+        wclrtoeol (main_w);
         if (msg->env->subject)
         if (msg->env->subject)
-          mutt_paddstr (W, msg->env->subject);
+          mutt_paddstr (main_w, W, msg->env->subject);
       }
       mutt_message_hook (NULL, msg, M_SEND2HOOK);
       break;
       }
       mutt_message_hook (NULL, msg, M_SEND2HOOK);
       break;
@@ -551,8 +550,8 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
       if (mutt_get_field ("Fcc: ", buf, sizeof (buf), M_FILE | M_CLEAR) == 0) {
         m_strcpy(fcc, _POSIX_PATH_MAX, buf);
         mutt_pretty_mailbox (fcc);
       if (mutt_get_field ("Fcc: ", buf, sizeof (buf), M_FILE | M_CLEAR) == 0) {
         m_strcpy(fcc, _POSIX_PATH_MAX, buf);
         mutt_pretty_mailbox (fcc);
-        wmove (stdscr, HDR_FCC, HDR_XOFFSET + SW);
-        mutt_paddstr (W, fcc);
+        wmove (main_w, HDR_FCC, HDR_XOFFSET);
+        mutt_paddstr (main_w, W, fcc);
         fccSet = 1;
       }
       MAYBE_REDRAW (menu->redraw);
         fccSet = 1;
       }
       MAYBE_REDRAW (menu->redraw);
@@ -971,7 +970,7 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
         int itype;
         FILE *fp;
 
         int itype;
         FILE *fp;
 
-        CLEARLINE (LINES - 1);
+        CLEARLINE(main_w, LINES - 1);
         fname[0] = 0;
         if (mutt_get_field (_("New file: "), fname, sizeof (fname), M_FILE)
             != 0 || !fname[0])
         fname[0] = 0;
         if (mutt_get_field (_("New file: "), fname, sizeof (fname), M_FILE)
             != 0 || !fname[0])
@@ -1171,11 +1170,11 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
     /* Draw formated compose status line */
     if (menu->redraw & REDRAW_STATUS) {
       compose_status_line (buf, sizeof (buf), menu, NONULL (ComposeFormat));
     /* Draw formated compose status line */
     if (menu->redraw & REDRAW_STATUS) {
       compose_status_line (buf, sizeof (buf), menu, NONULL (ComposeFormat));
-      CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES - 2);
-      SETCOLOR (MT_COLOR_STATUS);
-      wmove (stdscr, option (OPTSTATUSONTOP) ? 0 : LINES - 2, SW);
-      wprintw (stdscr, "%-*.*s", COLS-SW, COLS-SW, buf);
-      SETCOLOR (MT_COLOR_NORMAL);
+      CLEARLINE(main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2);
+      SETCOLOR(main_w, MT_COLOR_STATUS);
+      wmove (main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0);
+      wprintw (main_w, "%-*.*s", getmaxx(main_w), getmaxx(main_w), buf);
+      SETCOLOR(main_w, MT_COLOR_NORMAL);
       menu->redraw &= ~REDRAW_STATUS;
     }
   }
       menu->redraw &= ~REDRAW_STATUS;
     }
   }
index ae29cd2..7047775 100644 (file)
@@ -2268,8 +2268,8 @@ static void crypt_entry (char *s, ssize_t l, MUTTMENU * menu, int num)
   entry.key = cryptkey_table[num];
   entry.num = num + 1;
 
   entry.key = cryptkey_table[num];
   entry.num = num + 1;
 
-  m_strformat(s, l, COLS - SW, mod_crypt.pgp_entry_format, crypt_entry_fmt,
-              &entry, 0);
+  m_strformat(s, l, getmaxx(main_w), mod_crypt.pgp_entry_format,
+              crypt_entry_fmt, &entry, 0);
 }
 
 /* Compare two addresses and the keyid to be used for sorting. */
 }
 
 /* Compare two addresses and the keyid to be used for sorting. */
diff --git a/flags.c b/flags.c
index 9ef0f6d..aca2dcf 100644 (file)
--- a/flags.c
+++ b/flags.c
@@ -331,17 +331,17 @@ int mutt_change_flag(HEADER * h, int bf)
 
     int c;
 
 
     int c;
 
-    mvwprintw(stdscr, LINES - 1, 0, "%s? (D/N/O/r/*/!): ",
+    mvwprintw(main_w, LINES - 1, 0, "%s? (D/N/O/r/*/!): ",
              bf ? _("Set flag") : _("Clear flag"));
              bf ? _("Set flag") : _("Clear flag"));
-    wclrtoeol(stdscr);
+    wclrtoeol(main_w);
 
     c = mutt_getch().ch;
     if (c == -1) {
 
     c = mutt_getch().ch;
     if (c == -1) {
-        CLEARLINE (LINES - 1);
+        CLEARLINE(main_w, LINES - 1);
         return (-1);
     }
 
         return (-1);
     }
 
-    CLEARLINE (LINES - 1);
+    CLEARLINE(main_w, LINES - 1);
 
     if (c < 0 || c > countof(actions) || !actions[c]) {
         BEEP();
 
     if (c < 0 || c > countof(actions) || !actions[c]) {
         BEEP();
index 5545a8f..d3a3773 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -639,9 +639,8 @@ static int text_enriched_handler (BODY * a, STATE * s)
 
   p_clear(&stte, 1);
   stte.s = s;
 
   p_clear(&stte, 1);
   stte.s = s;
-  stte.WrapMargin =
-    ((s->flags & M_DISPLAY) ? (COLS - 4) : ((COLS - 4) <
-                                            72) ? (COLS - 4) : 72);
+  stte.WrapMargin = ((s->flags & M_DISPLAY) ? (getmaxx(main_w) - 4) :
+                     ((getmaxx(main_w) - 4) < 72) ? (getmaxx(main_w) - 4) : 72);
   stte.line_max = stte.WrapMargin * 4;
   stte.line = p_new(char, stte.line_max + 1);
   stte.param = p_new(char, STRING);
   stte.line_max = stte.WrapMargin * 4;
   stte.line = p_new(char, stte.line_max + 1);
   stte.param = p_new(char, STRING);
diff --git a/help.c b/help.c
index 4fee510..0717d64 100644 (file)
--- a/help.c
+++ b/help.c
@@ -119,14 +119,14 @@ static void help_format_line (FILE * f, int ismacro,
   fputs (t1, f);
 
   /* don't try to press string into one line with less than 40 characters. */
   fputs (t1, f);
 
   /* don't try to press string into one line with less than 40 characters. */
-  if ((split = COLS < 40)) {
+  if ((split = getmaxx(main_w) < 40)) {
     col_a = col = 0;
     col_b = LONG_STRING;
     fputc ('\n', f);
   }
   else {
     col_a = col = 0;
     col_b = LONG_STRING;
     fputc ('\n', f);
   }
   else {
-    col_a = COLS > 83 ? (COLS - 32) >> 2 : 12;
-    col_b = COLS > 49 ? (COLS - 10) >> 1 : 19;
+    col_a = getmaxx(main_w) > 83 ? (getmaxx(main_w) - 32) >> 2 : 12;
+    col_b = getmaxx(main_w) > 49 ? (getmaxx(main_w) - 10) >> 1 : 19;
     col = pad (f, m_strlen(t1), col_a);
   }
 
     col = pad (f, m_strlen(t1), col_a);
   }
 
@@ -153,14 +153,14 @@ static void help_format_line (FILE * f, int ismacro,
   }
   else {
     while (*t3) {
   }
   else {
     while (*t3) {
-      n = COLS - col;
+      n = getmaxx(main_w) - col;
 
       if (ismacro >= 0) {
         t3 = vskipspaces(t3);
 
         /* FIXME: this is completely wrong */
 
       if (ismacro >= 0) {
         t3 = vskipspaces(t3);
 
         /* FIXME: this is completely wrong */
-        if ((n = m_strlen(t3)) > COLS - col) {
-          n = COLS - col;
+        if ((n = m_strlen(t3)) > getmaxx(main_w) - col) {
+          n = getmaxx(main_w) - col;
           for (col_a = n; col_a > 0 && t3[col_a] != ' '; col_a--);
           if (col_a)
             n = col_a;
           for (col_a = n; col_a > 0 && t3[col_a] != ' '; col_a--);
           if (col_a)
             n = col_a;
@@ -170,7 +170,7 @@ static void help_format_line (FILE * f, int ismacro,
       print_macro (f, n, &t3);
 
       if (*t3) {
       print_macro (f, n, &t3);
 
       if (*t3) {
-        n += col - COLS;
+        n += col - getmaxx(main_w);
         if (option (OPTMARKERS))
           ++n;
         col = pad (f, n, col_b);
         if (option (OPTMARKERS))
           ++n;
         col = pad (f, n, col_b);
diff --git a/init.c b/init.c
index 0f57360..bcd4d14 100644 (file)
--- a/init.c
+++ b/init.c
@@ -434,7 +434,7 @@ int query_quadoption2(int v, const char *prompt)
 
   default:
     v = mutt_yesorno(prompt, (v == M_ASKYES));
 
   default:
     v = mutt_yesorno(prompt, (v == M_ASKYES));
-    CLEARLINE (LINES - 1);
+    CLEARLINE(main_w, LINES - 1);
     return (v);
   }
 }
     return (v);
   }
 }
@@ -450,7 +450,7 @@ int query_quadoption (int opt, const char *prompt)
 
   default:
     v = mutt_yesorno (prompt, (v == M_ASKYES));
 
   default:
     v = mutt_yesorno (prompt, (v == M_ASKYES));
-    CLEARLINE (LINES - 1);
+    CLEARLINE(main_w, LINES - 1);
     return (v);
   }
 
     return (v);
   }
 
diff --git a/init.h b/init.h
index 64e7db1..bee8e9d 100644 (file)
--- a/init.h
+++ b/init.h
@@ -223,15 +223,6 @@ struct option_t MuttVars[] = {
    ** \fTDelivered-To:\fP header fields when bouncing messages.
    ** Postfix users may wish to \fIunset\fP this variable.
    */
    ** \fTDelivered-To:\fP header fields when bouncing messages.
    ** Postfix users may wish to \fIunset\fP this variable.
    */
-  { "braille_friendly", DT_BOOL, R_NONE, OPTBRAILLEFRIENDLY, "no" },
-  /*
-   ** .pp
-   ** When this variable is set, mutt will place the cursor at the beginning
-   ** of the current line in menus, even when the arrow_cursor variable
-   ** is unset, making it easier for blind persons using Braille displays to
-   ** follow these menus.  The option is disabled by default because many
-   ** visual terminals don't permit making the cursor invisible.
-   */
   {"check_new", DT_BOOL, R_NONE, OPTCHECKNEW, "yes" },
   /*
    ** .pp
   {"check_new", DT_BOOL, R_NONE, OPTCHECKNEW, "yes" },
   /*
    ** .pp
index 15ed62d..f5fea68 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -334,12 +334,12 @@ int km_dokey (int menu)
   for (;;) {
     /* ncurses doesn't return on resized screen when timeout is set to zero */
     if (menu != MENU_EDITOR)
   for (;;) {
     /* ncurses doesn't return on resized screen when timeout is set to zero */
     if (menu != MENU_EDITOR)
-      wtimeout (stdscr, (Timeout > 0 ? Timeout : 60) * 1000);
+      wtimeout (main_w, (Timeout > 0 ? Timeout : 60) * 1000);
 
     tmp = mutt_getch ();
 
     if (menu != MENU_EDITOR)
 
     tmp = mutt_getch ();
 
     if (menu != MENU_EDITOR)
-      wtimeout (stdscr, -1);             /* restore blocking operation */
+      wtimeout (main_w, -1);             /* restore blocking operation */
 
     LastKey = tmp.ch;
     if (LastKey == -1)
 
     LastKey = tmp.ch;
     if (LastKey == -1)
index 45ce19e..3caa76f 100644 (file)
@@ -42,15 +42,12 @@ static void print_flowed_line (char *line, STATE * s, int ql) {
       width = MaxLineLength;
   }
   else {
       width = MaxLineLength;
   }
   else {
-    if (option (OPTMBOXPANE))
-      width = COLS - SidebarWidth - WrapMargin - ql - 1;
-    else
-      width = COLS - WrapMargin - ql - 1;
+    width = getmaxx(main_w) - WrapMargin - ql - 1;
 
     if (!(s->flags & M_REPLYING) && option (OPTSTUFFQUOTED))
       --width;
     if (width < 0)
 
     if (!(s->flags & M_REPLYING) && option (OPTSTUFFQUOTED))
       --width;
     if (width < 0)
-      width = COLS;
+      width = getmaxx(main_w);
   }
 
   if (m_strlen(line) == 0) {
   }
 
   if (m_strlen(line) == 0) {
index ea86e3b..a21eba8 100644 (file)
@@ -49,7 +49,7 @@ static void sighandler (int sig)
 
   case SIGCONT:
     if (!IsEndwin)
 
   case SIGCONT:
     if (!IsEndwin)
-      wrefresh (stdscr);
+      refresh();
     mutt_curs_set (-1);
     /* We don't receive SIGWINCH when suspended; however, no harm is done by
      * just assuming we received one, and triggering the 'resize' anyway. */
     mutt_curs_set (-1);
     /* We don't receive SIGWINCH when suspended; however, no harm is done by
      * just assuming we received one, and triggering the 'resize' anyway. */
index 98eaa54..9a1a65d 100644 (file)
@@ -600,7 +600,7 @@ _mutt_parse_color (BUFFER * buf, BUFFER * s, BUFFER * err,
     ColorDefs[object] = fgbgattr_to_color (fg, bg, attr);
 
   if (object == MT_COLOR_NORMAL && !option (OPTNOCURSES) && has_colors ())
     ColorDefs[object] = fgbgattr_to_color (fg, bg, attr);
 
   if (object == MT_COLOR_NORMAL && !option (OPTNOCURSES) && has_colors ())
-    BKGDSET (MT_COLOR_NORMAL);
+    BKGDSET(main_w, MT_COLOR_NORMAL);
 
   return (r);
 }
 
   return (r);
 }
index babbc72..8e74153 100644 (file)
@@ -46,7 +46,7 @@ event_t mutt_getch (void)
   SigInt = 0;
 
   mutt_allow_interrupt (1);
   SigInt = 0;
 
   mutt_allow_interrupt (1);
-  ch = wgetch (stdscr);
+  ch = getch();
   mutt_allow_interrupt (0);
 
   if (SigInt)
   mutt_allow_interrupt (0);
 
   if (SigInt)
@@ -60,6 +60,22 @@ event_t mutt_getch (void)
   return (ch == ctrl ('G') ? err : ret);
 }
 
   return (ch == ctrl ('G') ? err : ret);
 }
 
+#ifndef waddnwstr
+int waddwch(WINDOW *win, wchar_t wc)
+{
+    char buf[MB_LEN_MAX * 2];
+    mbstate_t mbstate;
+    ssize_t n1, n2;
+
+    p_clear(&mbstate, 1);
+    if ((n1 = wcrtomb(buf, wc, &mbstate)) == -1
+    ||  (n2 = wcrtomb(buf + n1, 0, &mbstate)) == -1)
+        return -1;                  /* ERR */
+    return waddstr(win, buf);
+}
+#endif
+
+
 int _mutt_get_field ( const char *field, char *buf, ssize_t buflen,
                      int complete, int multiple, char ***files, int *numfiles)
 {
 int _mutt_get_field ( const char *field, char *buf, ssize_t buflen,
                      int complete, int multiple, char ***files, int *numfiles)
 {
@@ -69,14 +85,14 @@ int _mutt_get_field ( const char *field, char *buf, ssize_t buflen,
   ENTER_STATE *es = mutt_new_enter_state ();
 
   do {
   ENTER_STATE *es = mutt_new_enter_state ();
 
   do {
-    CLEARLINE (LINES - 1);
+    CLEARLINE(stdscr, LINES - 1);
     waddstr (stdscr, field);
     mutt_refresh ();
     getyx (stdscr, y, x);
     ret = _mutt_enter_string(buf, buflen, y, x, complete, multiple, files,
                              numfiles, es);
   } while (ret == 1);
     waddstr (stdscr, field);
     mutt_refresh ();
     getyx (stdscr, y, x);
     ret = _mutt_enter_string(buf, buflen, y, x, complete, multiple, files,
                              numfiles, es);
   } while (ret == 1);
-  CLEARLINE (LINES - 1);
+  CLEARLINE(stdscr, LINES - 1);
   mutt_free_enter_state (&es);
 
   return (ret);
   mutt_free_enter_state (&es);
 
   return (ret);
@@ -97,7 +113,7 @@ void mutt_clear_error (void)
 {
   Errorbuf[0] = 0;
   if (!option (OPTNOCURSES))
 {
   Errorbuf[0] = 0;
   if (!option (OPTNOCURSES))
-    CLEARLINE (LINES - 1);
+    CLEARLINE(stdscr, LINES - 1);
 }
 
 void mutt_edit_file(const char *data)
 }
 
 void mutt_edit_file(const char *data)
@@ -133,7 +149,7 @@ int mutt_yesorno (const char *msg, int def)
   reno_ok = (expr = nl_langinfo (NOEXPR)) && expr[0] == '^' &&
     !regcomp (&reno, expr, REG_NOSUB | REG_EXTENDED);
 
   reno_ok = (expr = nl_langinfo (NOEXPR)) && expr[0] == '^' &&
     !regcomp (&reno, expr, REG_NOSUB | REG_EXTENDED);
 
-  CLEARLINE (LINES - 1);
+  CLEARLINE(stdscr, LINES - 1);
 
   /*
    * In order to prevent the default answer to the question to wrapped
 
   /*
    * In order to prevent the default answer to the question to wrapped
@@ -141,11 +157,11 @@ int mutt_yesorno (const char *msg, int def)
    * ensure there is enough room for the answer and truncate the question
    * to fit.
    */
    * ensure there is enough room for the answer and truncate the question
    * to fit.
    */
-  answer_string = p_new(char, COLS + 1);
-  snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def == M_YES ? yes : no,
+  answer_string = p_new(char, getmaxx(stdscr) + 1);
+  snprintf (answer_string, getmaxx(stdscr) + 1, " ([%s]/%s): ", def == M_YES ? yes : no,
             def == M_YES ? no : yes);
   answer_string_len = m_strlen(answer_string);
             def == M_YES ? no : yes);
   answer_string_len = m_strlen(answer_string);
-  wprintw (stdscr, "%.*s%s", COLS - answer_string_len, msg, answer_string);
+  wprintw (stdscr, "%.*s%s", getmaxx(stdscr) - answer_string_len, msg, answer_string);
   p_delete(&answer_string);
 
   for (;;) {
   p_delete(&answer_string);
 
   for (;;) {
@@ -212,15 +228,15 @@ void mutt_curses_error (const char *fmt, ...)
   va_end (ap);
 
   mutt_format_string (TmpErrorbuf, sizeof (TmpErrorbuf),
   va_end (ap);
 
   mutt_format_string (TmpErrorbuf, sizeof (TmpErrorbuf),
-                      0, COLS - 2, 0, 0, Errorbuf, sizeof (Errorbuf), 0);
+                      0, getmaxy(stdscr) - 2, 0, 0, Errorbuf, sizeof (Errorbuf), 0);
   snprintf (Errorbuf, sizeof (Errorbuf), "%s", TmpErrorbuf);    /* overkill */
 
   if (!option (OPTKEEPQUIET)) {
     BEEP ();
   snprintf (Errorbuf, sizeof (Errorbuf), "%s", TmpErrorbuf);    /* overkill */
 
   if (!option (OPTKEEPQUIET)) {
     BEEP ();
-    SETCOLOR (MT_COLOR_ERROR);
+    SETCOLOR(stdscr, MT_COLOR_ERROR);
     mvwaddstr (stdscr, LINES - 1, 0, Errorbuf);
     wclrtoeol (stdscr);
     mvwaddstr (stdscr, LINES - 1, 0, Errorbuf);
     wclrtoeol (stdscr);
-    SETCOLOR (MT_COLOR_NORMAL);
+    SETCOLOR(stdscr, MT_COLOR_NORMAL);
     mutt_refresh ();
   }
 
     mutt_refresh ();
   }
 
@@ -265,14 +281,14 @@ void mutt_curses_message (const char *fmt, ...)
   va_end (ap);
 
   mutt_format_string (TmpErrorbuf, sizeof (TmpErrorbuf),
   va_end (ap);
 
   mutt_format_string (TmpErrorbuf, sizeof (TmpErrorbuf),
-                      0, COLS - 2, 0, 0, Errorbuf, sizeof (Errorbuf), 0);
+                      0, getmaxx(stdscr) - 2, 0, 0, Errorbuf, sizeof (Errorbuf), 0);
   snprintf (Errorbuf, sizeof (Errorbuf), "%s", TmpErrorbuf);    /* overkill */
 
   if (!option (OPTKEEPQUIET)) {
   snprintf (Errorbuf, sizeof (Errorbuf), "%s", TmpErrorbuf);    /* overkill */
 
   if (!option (OPTKEEPQUIET)) {
-    SETCOLOR (MT_COLOR_MESSAGE);
+    SETCOLOR(stdscr, MT_COLOR_MESSAGE);
     mvwaddstr (stdscr, LINES - 1, 0, Errorbuf);
     wclrtoeol (stdscr);
     mvwaddstr (stdscr, LINES - 1, 0, Errorbuf);
     wclrtoeol (stdscr);
-    SETCOLOR (MT_COLOR_NORMAL);
+    SETCOLOR(stdscr, MT_COLOR_NORMAL);
     mutt_refresh ();
   }
 
     mutt_refresh ();
   }
 
@@ -284,20 +300,20 @@ void mutt_show_error (void)
   if (option (OPTKEEPQUIET))
     return;
 
   if (option (OPTKEEPQUIET))
     return;
 
-  SETCOLOR (option (OPTMSGERR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
-  CLEARLINE (LINES - 1);
+  SETCOLOR(stdscr, option (OPTMSGERR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
+  CLEARLINE(stdscr, LINES - 1);
   waddstr (stdscr, Errorbuf);
   waddstr (stdscr, Errorbuf);
-  SETCOLOR (MT_COLOR_NORMAL);
+  SETCOLOR(stdscr, MT_COLOR_NORMAL);
 }
 
 void curses_initialize(void)
 {
     ci_start_color();
 }
 
 void curses_initialize(void)
 {
     ci_start_color();
-    keypad(stdscr, TRUE);
+    keypad(stdscr, true);
     cbreak();
     noecho();
     typeahead (-1);               /* simulate smooth scrolling */
     cbreak();
     noecho();
     typeahead (-1);               /* simulate smooth scrolling */
-    meta(stdscr, TRUE);
+    meta(stdscr, true);
 }
 
 void _mutt_perror (const char *s, const char* filename, int line)
 }
 
 void _mutt_perror (const char *s, const char* filename, int line)
@@ -314,9 +330,9 @@ void mutt_what_key (void)
 {
   int ch;
 
 {
   int ch;
 
-  mvwprintw (stdscr, LINES - 1, 0, _("Enter keys (^G to abort): "));
+  mvwprintw(stdscr, LINES - 1, 0, _("Enter keys (^G to abort): "));
   do {
   do {
-    ch = wgetch (stdscr);
+    ch = getch();
     if (ch != ERR && ch != ctrl ('G')) {
       mutt_message (_("Char = %s, Octal = %o, Decimal = %d"),
                     km_keyname (ch), ch, ch);
     if (ch != ERR && ch != ctrl ('G')) {
       mutt_message (_("Char = %s, Octal = %o, Decimal = %d"),
                     km_keyname (ch), ch, ch);
@@ -361,8 +377,8 @@ int _mutt_enter_fname (const char *prompt, char *buf, ssize_t blen,
 {
   event_t ch;
 
 {
   event_t ch;
 
-  mvwaddstr (stdscr, LINES - 1, 0, (char *) prompt);
-  waddstr (stdscr, _(" ('?' for list): "));
+  mvwaddstr(stdscr, LINES - 1, 0, (char *) prompt);
+  waddstr(stdscr, _(" ('?' for list): "));
   if (buf[0])
     waddstr (stdscr, buf);
   wclrtoeol (stdscr);
   if (buf[0])
     waddstr (stdscr, buf);
   wclrtoeol (stdscr);
@@ -370,7 +386,7 @@ int _mutt_enter_fname (const char *prompt, char *buf, ssize_t blen,
 
   ch = mutt_getch ();
   if (ch.ch == -1) {
 
   ch = mutt_getch ();
   if (ch.ch == -1) {
-    CLEARLINE (LINES - 1);
+    CLEARLINE(stdscr, LINES - 1);
     return (-1);
   }
   else if (ch.ch == '?') {
     return (-1);
   }
   else if (ch.ch == '?') {
@@ -465,29 +481,11 @@ int mutt_multi_choice (const char *prompt, const char *letters)
     }
     BEEP ();
   }
     }
     BEEP ();
   }
-  CLEARLINE (LINES - 1);
+  CLEARLINE(stdscr, LINES - 1);
   mutt_refresh ();
   return choice;
 }
 
   mutt_refresh ();
   return choice;
 }
 
-/*
- * addwch would be provided by an up-to-date curses library
- */
-
-int mutt_addwch (wchar_t wc)
-{
-  char buf[MB_LEN_MAX * 2];
-  mbstate_t mbstate;
-  ssize_t n1, n2;
-
-  p_clear(&mbstate, 1);
-  if ((n1 = wcrtomb(buf, wc, &mbstate)) == -1 ||
-      (n2 = wcrtomb(buf + n1, 0, &mbstate)) == -1)
-    return -1;                  /* ERR */
-  else
-    return waddstr (stdscr, buf);
-}
-
 ssize_t mutt_pretty_size(char *s, ssize_t len, ssize_t n)
 {
     if (n == 0)
 ssize_t mutt_pretty_size(char *s, ssize_t len, ssize_t n)
 {
     if (n == 0)
@@ -613,10 +611,10 @@ void mutt_format_s_tree (char *dest, ssize_t destlen,
 
 /*
  * mutt_paddstr (n, s) is almost equivalent to
 
 /*
  * mutt_paddstr (n, s) is almost equivalent to
- * mutt_format_string (bigbuf, big, n, n, 0, ' ', s, big, 0), waddstr (stdscr, bigbuf)
+ * mutt_format_string (bigbuf, big, n, n, 0, ' ', s, big, 0), waddstr (main_w, bigbuf)
  */
 
  */
 
-void mutt_paddstr (int n, const char *s)
+void mutt_paddstr(WINDOW *win, int n, const char *s)
 {
   wchar_t wc;
   int w;
 {
   wchar_t wc;
   int w;
@@ -636,10 +634,10 @@ void mutt_paddstr (int n, const char *s)
     if (w >= 0) {
       if (w > n)
         break;
     if (w >= 0) {
       if (w > n)
         break;
-      waddnstr (stdscr, (char *) s, k);
+      waddnstr(win, (char *) s, k);
       n -= w;
     }
   }
   while (n-- > 0)
       n -= w;
     }
   }
   while (n-- > 0)
-    waddch (stdscr, ' ');
+    waddch(win, ' ');
 }
 }
index 3fe1cd3..140668c 100644 (file)
@@ -86,7 +86,6 @@ static const char *No_visible = N_("No visible messages.");
 #define CURHDR Context->hdrs[Context->v2r[menu->current]]
 #define OLDHDR Context->hdrs[Context->v2r[menu->oldcurrent]]
 #define UNREAD(h) mutt_thread_contains_unread (Context, h)
 #define CURHDR Context->hdrs[Context->v2r[menu->current]]
 #define OLDHDR Context->hdrs[Context->v2r[menu->oldcurrent]]
 #define UNREAD(h) mutt_thread_contains_unread (Context, h)
-#define SW              (option(OPTMBOXPANE)?SidebarWidth:0)
 
 extern size_t UngetCount;
 
 
 extern size_t UngetCount;
 
@@ -498,13 +497,13 @@ int mutt_index_menu (void)
 
       if (menu->redraw & REDRAW_STATUS) {
         menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
 
       if (menu->redraw & REDRAW_STATUS) {
         menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
-        CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES - 2);
-        SETCOLOR (MT_COLOR_STATUS);
-        BKGDSET (MT_COLOR_STATUS);
-        wmove(stdscr, option (OPTSTATUSONTOP) ? 0 : LINES - 2,SW);
-        mutt_paddstr (COLS-SW, buf);
-        SETCOLOR (MT_COLOR_NORMAL);
-        BKGDSET (MT_COLOR_NORMAL);
+        CLEARLINE(main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2);
+        SETCOLOR(main_w, MT_COLOR_STATUS);
+        BKGDSET(main_w, MT_COLOR_STATUS);
+        wmove(main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0);
+        mutt_paddstr (main_w, getmaxx(main_w), buf);
+        SETCOLOR(main_w, MT_COLOR_NORMAL);
+        BKGDSET(main_w, MT_COLOR_NORMAL);
         sidebar_set_buffystats (Context);
         menu->redraw &= ~REDRAW_STATUS;
         if (option (OPTXTERMSETTITLES)) {
         sidebar_set_buffystats (Context);
         menu->redraw &= ~REDRAW_STATUS;
         if (option (OPTXTERMSETTITLES)) {
@@ -521,11 +520,6 @@ int mutt_index_menu (void)
         menu->oldcurrent = menu->current;
       else
         menu->oldcurrent = -1;
         menu->oldcurrent = menu->current;
       else
         menu->oldcurrent = -1;
-
-      if (option (OPTBRAILLEFRIENDLY))
-         wmove (stdscr, menu->current - menu->top + menu->offset, 0);
-      else
-        wmove (stdscr, menu->current - menu->top + menu->offset, COLS - 1);
       mutt_refresh ();
 
       if (SigWinch) {
       mutt_refresh ();
 
       if (SigWinch) {
@@ -559,13 +553,13 @@ int mutt_index_menu (void)
         tag = 1;
 
         /* give visual indication that the next command is a tag- command */
         tag = 1;
 
         /* give visual indication that the next command is a tag- command */
-        mvwaddstr (stdscr, LINES - 1, 0, "tag-");
-        wclrtoeol (stdscr);
+        mvwaddstr (main_w, LINES - 1, 0, "tag-");
+        wclrtoeol (main_w);
 
         /* get the real command */
         if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX) {
           /* abort tag sequence */
 
         /* get the real command */
         if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX) {
           /* abort tag sequence */
-          CLEARLINE (LINES - 1);
+          CLEARLINE(main_w, LINES - 1);
           continue;
         }
       }
           continue;
         }
       }
@@ -594,13 +588,13 @@ int mutt_index_menu (void)
         tag = 1;
 
         /* give visual indication that the next command is a tag- command */
         tag = 1;
 
         /* give visual indication that the next command is a tag- command */
-        mvwaddstr (stdscr, LINES - 1, 0, "tag-");
-        wclrtoeol (stdscr);
+        mvwaddstr (main_w, LINES - 1, 0, "tag-");
+        wclrtoeol (main_w);
 
         /* get the real command */
         if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX) {
           /* abort tag sequence */
 
         /* get the real command */
         if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX) {
           /* abort tag sequence */
-          CLEARLINE (LINES - 1);
+          CLEARLINE(main_w, LINES - 1);
           continue;
         }
       }
           continue;
         }
       }
@@ -940,8 +934,7 @@ int mutt_index_menu (void)
       break;
 
     case OP_REDRAW:
       break;
 
     case OP_REDRAW:
-
-      clearok (stdscr, TRUE);
+      clearok (main_w, TRUE);
       menu->redraw = REDRAW_FULL;
       break;
 
       menu->redraw = REDRAW_FULL;
       break;
 
@@ -1136,7 +1129,7 @@ int mutt_index_menu (void)
           break;
       }
       if (!buf[0]) {
           break;
       }
       if (!buf[0]) {
-        CLEARLINE (LINES - 1);
+        CLEARLINE(main_w, LINES - 1);
         break;
       }
 
         break;
       }
 
index 9f7f272..5029316 100644 (file)
 #undef lines
 #endif /* lines */
 
 #undef lines
 #endif /* lines */
 
-#define CLEARLINE_WIN(x) wmove(stdscr, x,(option(OPTMBOXPANE)?SidebarWidth:0)), wclrtoeol(stdscr)
-#define CLEARLINE(x) wmove(stdscr, x,0), wclrtoeol(stdscr)
-#define CENTERLINE(x,y) wmove(stdscr, y, (COLS-strlen(x))/2), waddstr(stdscr, x)
+#define CLEARLINE(W, x) wmove(W, x,0), wclrtoeol(W)
 #define BEEP() do { if (mod_core.beep) beep(); } while (0)
 
 #define BEEP() do { if (mod_core.beep) beep(); } while (0)
 
-#define BKGDSET(x)  wbkgdset(stdscr, ColorDefs[x] | ' ')
+#define BKGDSET(W, x)   wbkgdset(W, ColorDefs[x] | ' ')
+#define SETCOLOR(W, X)  wattrset(W, ColorDefs[X])
+#define ADDCOLOR(W, X)  wattron(W, ColorDefs[X])
 
 void mutt_curs_set (int);
 
 void mutt_curs_set (int);
-#define PAGELEN (LINES-3)
 
 #define ctrl(c) ((c)-'@')
 
 
 #define ctrl(c) ((c)-'@')
 
@@ -38,6 +37,11 @@ void mutt_curs_set (int);
 #endif
 
 event_t mutt_getch (void);
 #endif
 
 event_t mutt_getch (void);
+#ifndef waddnwstr
+int waddwch(WINDOW *win, wchar_t w);
+#else
+#define waddwch(win, w)  waddnwstr(win, &(w), 1)
+#endif
 
 void curses_initialize(void);
 void curses_install(void);
 
 void curses_initialize(void);
 void curses_install(void);
@@ -104,7 +108,7 @@ void mutt_format_string (char *, ssize_t, int, int, int, char, const char *,
 void mutt_format_s (char *, ssize_t, const char *, const char *);
 void mutt_format_s_tree (char *, ssize_t, const char *, const char *);
 void mutt_free_color (int fg, int bg);
 void mutt_format_s (char *, ssize_t, const char *, const char *);
 void mutt_format_s_tree (char *, ssize_t, const char *, const char *);
 void mutt_free_color (int fg, int bg);
-void mutt_paddstr (int, const char *);
+void mutt_paddstr(WINDOW *, int, const char *);
 #define mutt_perror(a) _mutt_perror (a, __FILE__, __LINE__)
 void _mutt_perror (const char*, const char*,int);
 void mutt_query_exit (void);
 #define mutt_perror(a) _mutt_perror (a, __FILE__, __LINE__)
 void _mutt_perror (const char*, const char*,int);
 void mutt_query_exit (void);
@@ -112,7 +116,6 @@ void mutt_query_menu (char *, ssize_t);
 void mutt_show_error (void);
 ssize_t mutt_pretty_size(char *s, ssize_t len, ssize_t n);
 
 void mutt_show_error (void);
 ssize_t mutt_pretty_size(char *s, ssize_t len, ssize_t n);
 
-int mutt_addwch (wchar_t);
 int mutt_alloc_color (int fg, int bg);
 int mutt_any_key_to_continue (const char *);
 void mutt_what_key (void);
 int mutt_alloc_color (int fg, int bg);
 int mutt_any_key_to_continue (const char *);
 void mutt_what_key (void);
@@ -150,13 +153,6 @@ void ci_start_color (void);
 void _mutt_make_string (char *, ssize_t, const char *, CONTEXT *,
                         HEADER *, format_flag);
 
 void _mutt_make_string (char *, ssize_t, const char *, CONTEXT *,
                         HEADER *, format_flag);
 
-
-#define WSETCOLOR(w, X) wattrset(w, ColorDefs[X])
-#define SETCOLOR(X) wattrset(stdscr, ColorDefs[X])
-#define ADDCOLOR(X) wattron(stdscr, ColorDefs[X])
-
 #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; }
 
 #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; }
 
-#define SW              (option(OPTMBOXPANE)?SidebarWidth:0)
-
 #endif /* !_MUTT_CURSES_H */
 #endif /* !_MUTT_CURSES_H */
index bea29af..7fb61cc 100644 (file)
@@ -55,7 +55,7 @@ static int my_addwch (wchar_t wc)
   int n = wcwidth (wc);
 
   if (iswprint(wc) && n > 0)
   int n = wcwidth (wc);
 
   if (iswprint(wc) && n > 0)
-    return mutt_addwch (wc);
+    return waddwch(stdscr, wc);
   if (!(wc & ~0x7f))
     return wprintw (stdscr, "^%c", ((int) wc + 0x40) & 0x7f);
   if (!(wc & ~0xffff))
   if (!(wc & ~0x7f))
     return wprintw (stdscr, "^%c", ((int) wc + 0x40) & 0x7f);
   if (!(wc & ~0xffff))
index 4f5e5e4..c0cef6d 100644 (file)
@@ -755,5 +755,5 @@ _mutt_make_string (char *dest, ssize_t destlen, const char *s, CONTEXT * ctx,
   hfi.hdr = hdr;
   hfi.ctx = ctx;
 
   hfi.hdr = hdr;
   hfi.ctx = ctx;
 
-  m_strformat(dest, destlen, COLS - SW, s, hdr_format_str, &hfi, flags);
+  m_strformat(dest, destlen, getmaxx(main_w), s, hdr_format_str, &hfi, flags);
 }
 }
index 50fd0b6..bae1d2a 100644 (file)
@@ -30,8 +30,8 @@ WINDOW *sidebar_w, *main_w;
 
 void mutt_need_hard_redraw(void)
 {
 
 void mutt_need_hard_redraw(void)
 {
-    keypad(stdscr, true);
-    clearok(stdscr, true);
+    keypad(main_w, true);
+    clearok(main_w, true);
     set_option(OPTNEEDREDRAW);
 }
 
     set_option(OPTNEEDREDRAW);
 }
 
@@ -49,26 +49,28 @@ void mutt_refresh(void)
         return;
 
     /* else */
         return;
 
     /* else */
-    wrefresh(stdscr);
     if (sidebar_w)
     if (sidebar_w)
-        wrefresh(sidebar_w);
-    wrefresh(main_w);
-    main_w = NULL;
+        wnoutrefresh(sidebar_w);
+    if (main_w)
+        wnoutrefresh(main_w);
+    wrefresh(stdscr);
 }
 
 void mutt_endwin(const char *msg)
 {
     if (!option(OPTNOCURSES)) {
 }
 
 void mutt_endwin(const char *msg)
 {
     if (!option(OPTNOCURSES)) {
-        CLEARLINE(LINES - 1);
+        CLEARLINE(main_w, LINES - 1);
 
         if (sidebar_w) {
             delwin(sidebar_w);
             sidebar_w = NULL;
         }
 
         if (sidebar_w) {
             delwin(sidebar_w);
             sidebar_w = NULL;
         }
+#if 0
         if (main_w) {
             delwin(main_w);
             main_w = NULL;
         }
         if (main_w) {
             delwin(main_w);
             main_w = NULL;
         }
+#endif
 
         wattrset(stdscr, A_NORMAL);
         mutt_refresh();
 
         wattrset(stdscr, A_NORMAL);
         mutt_refresh();
@@ -83,12 +85,11 @@ void mutt_endwin(const char *msg)
 
 void ui_layout_init(void)
 {
 
 void ui_layout_init(void)
 {
-    SETCOLOR(MT_COLOR_NORMAL);
-    wclear(stdscr);
+    main_w = newwin(LINES - 1, COLS, 0, 0);
+    SETCOLOR(main_w, MT_COLOR_NORMAL);
+    wclear(main_w);
     mutt_error   = mutt_curses_error;
     mutt_message = mutt_curses_message;
     mutt_error   = mutt_curses_error;
     mutt_message = mutt_curses_message;
-
-    main_w = newwin(LINES - 1, COLS, 0, 0);
 }
 
 void ui_layout_resize(void)
 }
 
 void ui_layout_resize(void)
@@ -113,7 +114,7 @@ void ui_layout_resize(void)
         resizeterm(rows, cols);
         SigWinch = 0;
         /* force a real complete redraw. */
         resizeterm(rows, cols);
         SigWinch = 0;
         /* force a real complete redraw. */
-        clearok(stdscr, true);
+        clearok(main_w, true);
     }
 }
 
     }
 }
 
@@ -126,6 +127,7 @@ WINDOW *ui_layout_sidebar_w(void)
         if (!sidebar_w) {
             sidebar_w = newwin(LINES - 1, SidebarWidth, 0, 0);
             wresize(main_w, LINES - 1, COLS - SidebarWidth);
         if (!sidebar_w) {
             sidebar_w = newwin(LINES - 1, SidebarWidth, 0, 0);
             wresize(main_w, LINES - 1, COLS - SidebarWidth);
+            mvwin(main_w, 0, SidebarWidth);
         }
 
         getmaxyx(sidebar_w, sh, sw);
         }
 
         getmaxyx(sidebar_w, sh, sw);
@@ -133,12 +135,14 @@ WINDOW *ui_layout_sidebar_w(void)
         if (sh != LINES - 1 || sw != SidebarWidth) {
             wresize(sidebar_w, LINES - 1, SidebarWidth);
             wresize(main_w, LINES - 1, COLS - SidebarWidth);
         if (sh != LINES - 1 || sw != SidebarWidth) {
             wresize(sidebar_w, LINES - 1, SidebarWidth);
             wresize(main_w, LINES - 1, COLS - SidebarWidth);
+            mvwin(main_w, 0, SidebarWidth);
         }
     } else {
         if (sidebar_w) {
             delwin(sidebar_w);
             sidebar_w = NULL;
             wresize(main_w, LINES - 1, COLS);
         }
     } else {
         if (sidebar_w) {
             delwin(sidebar_w);
             sidebar_w = NULL;
             wresize(main_w, LINES - 1, COLS);
+            mvwin(main_w, 0, 0);
         }
     }
     return sidebar_w;
         }
     }
     return sidebar_w;
index 0a1d716..f8a2565 100644 (file)
@@ -18,8 +18,6 @@
 #include <imap/imap.h>
 #include <lib-ui/sidebar.h>
 
 #include <imap/imap.h>
 #include <lib-ui/sidebar.h>
 
-#define SW              (option(OPTMBOXPANE)?SidebarWidth:0)
-
 extern size_t UngetCount;
 
 static void print_enriched_string (int attr, unsigned char *s, int do_color)
 extern size_t UngetCount;
 
 static void print_enriched_string (int attr, unsigned char *s, int do_color)
@@ -33,56 +31,56 @@ static void print_enriched_string (int attr, unsigned char *s, int do_color)
   while (*s) {
     if (*s < M_TREE_MAX) {
       if (do_color)
   while (*s) {
     if (*s < M_TREE_MAX) {
       if (do_color)
-        SETCOLOR (MT_COLOR_TREE);
+        SETCOLOR(main_w, MT_COLOR_TREE);
       while (*s && *s < M_TREE_MAX) {
         switch (*s) {
         case M_TREE_LLCORNER:
       while (*s && *s < M_TREE_MAX) {
         switch (*s) {
         case M_TREE_LLCORNER:
-          waddch (stdscr, ACS_LLCORNER);
+          waddch (main_w, ACS_LLCORNER);
           break;
         case M_TREE_ULCORNER:
           break;
         case M_TREE_ULCORNER:
-          waddch (stdscr, ACS_ULCORNER);
+          waddch (main_w, ACS_ULCORNER);
           break;
         case M_TREE_LTEE:
           break;
         case M_TREE_LTEE:
-          waddch (stdscr, ACS_LTEE);
+          waddch (main_w, ACS_LTEE);
           break;
         case M_TREE_HLINE:
           break;
         case M_TREE_HLINE:
-          waddch (stdscr, ACS_HLINE);
+          waddch (main_w, ACS_HLINE);
           break;
         case M_TREE_VLINE:
           break;
         case M_TREE_VLINE:
-          waddch (stdscr, ACS_VLINE);
+          waddch (main_w, ACS_VLINE);
           break;
         case M_TREE_TTEE:
           break;
         case M_TREE_TTEE:
-          waddch (stdscr, ACS_TTEE);
+          waddch (main_w, ACS_TTEE);
           break;
         case M_TREE_BTEE:
           break;
         case M_TREE_BTEE:
-          waddch (stdscr, ACS_BTEE);
+          waddch (main_w, ACS_BTEE);
           break;
         case M_TREE_SPACE:
           break;
         case M_TREE_SPACE:
-          waddch (stdscr, ' ');
+          waddch (main_w, ' ');
           break;
         case M_TREE_RARROW:
           break;
         case M_TREE_RARROW:
-          waddch (stdscr, '>');
+          waddch (main_w, '>');
           break;
         case M_TREE_STAR:
           break;
         case M_TREE_STAR:
-          waddch (stdscr, '*');          /* fake thread indicator */
+          waddch (main_w, '*');          /* fake thread indicator */
           break;
         case M_TREE_HIDDEN:
           break;
         case M_TREE_HIDDEN:
-          waddch (stdscr, '&');
+          waddch (main_w, '&');
           break;
         case M_TREE_EQUALS:
           break;
         case M_TREE_EQUALS:
-          waddch (stdscr, '=');
+          waddch (main_w, '=');
           break;
         case M_TREE_MISSING:
           break;
         case M_TREE_MISSING:
-          waddch (stdscr, '?');
+          waddch (main_w, '?');
           break;
         }
         s++, n--;
       }
       if (do_color)
           break;
         }
         s++, n--;
       }
       if (do_color)
-        wattrset (stdscr, attr);
+        wattrset (main_w, attr);
     }
     else if ((k = mbrtowc (&wc, (char *) s, n, &mbstate)) != (size_t)-1) {
     }
     else if ((k = mbrtowc (&wc, (char *) s, n, &mbstate)) != (size_t)-1) {
-      waddnstr (stdscr, (char *) s, k);
+      waddnstr (main_w, (char *) s, k);
       s += k, n -= k;
     }
     else
       s += k, n -= k;
     }
     else
@@ -102,7 +100,7 @@ static void menu_make_entry (char *s, int l, MUTTMENU * menu, int i)
 
 static void menu_pad_string (char *s, size_t n)
 {
 
 static void menu_pad_string (char *s, size_t n)
 {
-  int cols = COLS - SW;
+  int cols = getmaxx(main_w);
   char *tmpbuf = p_new(char, n);
 
   mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, m_strlen(s), 1);
   char *tmpbuf = p_new(char, n);
 
   mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, m_strlen(s), 1);
@@ -113,15 +111,15 @@ static void menu_pad_string (char *s, size_t n)
 
 void menu_redraw_full (MUTTMENU * menu)
 {
 
 void menu_redraw_full (MUTTMENU * menu)
 {
-  SETCOLOR (MT_COLOR_NORMAL);
-  /* wclear(stdscr) doesn't optimize screen redraws */
-  wmove (stdscr, 0, 0);
-  wclrtobot (stdscr);
-
-  SETCOLOR (MT_COLOR_STATUS);
-  wmove (stdscr, option (OPTSTATUSONTOP) ? LINES - 2 : 0, SW);
-  mutt_paddstr (COLS-SW, "");
-  SETCOLOR (MT_COLOR_NORMAL);
+  SETCOLOR(main_w, MT_COLOR_NORMAL);
+  /* wclear() doesn't optimize screen redraws */
+  wmove (main_w, 0, 0);
+  wclrtobot (main_w);
+
+  SETCOLOR(main_w, MT_COLOR_STATUS);
+  wmove (main_w, option (OPTSTATUSONTOP) ? LINES - 2 : 0, 0);
+  mutt_paddstr (main_w, getmaxx(main_w), "");
+  SETCOLOR(main_w, MT_COLOR_NORMAL);
   menu->offset = 1;
   menu->pagelen = LINES - 3;
   mutt_show_error ();
   menu->offset = 1;
   menu->pagelen = LINES - 3;
   mutt_show_error ();
@@ -134,10 +132,10 @@ void menu_redraw_status (MUTTMENU * menu)
   char buf[STRING];
 
   snprintf (buf, sizeof (buf), M_MODEFMT, menu->title);
   char buf[STRING];
 
   snprintf (buf, sizeof (buf), M_MODEFMT, menu->title);
-  SETCOLOR (MT_COLOR_STATUS);
-  wmove (stdscr, option (OPTSTATUSONTOP) ? 0 : LINES - 2, SW);
-  mutt_paddstr (COLS-SW, buf);
-  SETCOLOR (MT_COLOR_NORMAL);
+  SETCOLOR(main_w, MT_COLOR_STATUS);
+  wmove (main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0);
+  mutt_paddstr (main_w, getmaxx(main_w), buf);
+  SETCOLOR(main_w, MT_COLOR_NORMAL);
   menu->redraw &= ~REDRAW_STATUS;
 }
 
   menu->redraw &= ~REDRAW_STATUS;
 }
 
@@ -151,22 +149,22 @@ void menu_redraw_index (MUTTMENU * menu)
       menu_make_entry (buf, sizeof (buf), menu, i);
       menu_pad_string (buf, sizeof (buf));
 
       menu_make_entry (buf, sizeof (buf), menu, i);
       menu_pad_string (buf, sizeof (buf));
 
-      wattrset (stdscr, menu->color (i));
+      wattrset (main_w, menu->color (i));
 
       if (i == menu->current) {
 
       if (i == menu->current) {
-        ADDCOLOR (MT_COLOR_INDICATOR);
-        BKGDSET (MT_COLOR_INDICATOR);
+        ADDCOLOR(main_w, MT_COLOR_INDICATOR);
+        BKGDSET(main_w, MT_COLOR_INDICATOR);
       }
 
       }
 
-      CLEARLINE_WIN (i - menu->top + menu->offset);
+      CLEARLINE(main_w, i - menu->top + menu->offset);
 
 
-      wmove (stdscr, i - menu->top + menu->offset, SW);
+      wmove (main_w, i - menu->top + menu->offset, 0);
       print_enriched_string (menu->color (i), (unsigned char *) buf,
                              i != menu->current);
       print_enriched_string (menu->color (i), (unsigned char *) buf,
                              i != menu->current);
-      SETCOLOR (MT_COLOR_NORMAL);
-      BKGDSET (MT_COLOR_NORMAL);
+      SETCOLOR(main_w, MT_COLOR_NORMAL);
+      BKGDSET(main_w, MT_COLOR_NORMAL);
     } else {
     } else {
-      CLEARLINE_WIN (i - menu->top + menu->offset);
+      CLEARLINE(main_w, i - menu->top + menu->offset);
     }
   }
   sidebar_draw ();
     }
   }
   sidebar_draw ();
@@ -183,13 +181,13 @@ void menu_redraw_motion (MUTTMENU * menu)
     return;
   }
 
     return;
   }
 
-  wmove (stdscr, menu->oldcurrent + menu->offset - menu->top, SW);
-  SETCOLOR (MT_COLOR_NORMAL);
-  BKGDSET (MT_COLOR_NORMAL);
+  wmove (main_w, menu->oldcurrent + menu->offset - menu->top, 0);
+  SETCOLOR(main_w, MT_COLOR_NORMAL);
+  BKGDSET(main_w, MT_COLOR_NORMAL);
 
   /* erase the current indicator */
 
   /* erase the current indicator */
-  wattrset (stdscr, menu->color (menu->oldcurrent));
-  wclrtoeol (stdscr);
+  wattrset (main_w, menu->color (menu->oldcurrent));
+  wclrtoeol (main_w);
   menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
   menu_pad_string (buf, sizeof (buf));
   print_enriched_string (menu->color (menu->oldcurrent),
   menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
   menu_pad_string (buf, sizeof (buf));
   print_enriched_string (menu->color (menu->oldcurrent),
@@ -198,15 +196,15 @@ void menu_redraw_motion (MUTTMENU * menu)
   /* now draw the new one to reflect the change */
   menu_make_entry (buf, sizeof (buf), menu, menu->current);
   menu_pad_string (buf, sizeof (buf));
   /* now draw the new one to reflect the change */
   menu_make_entry (buf, sizeof (buf), menu, menu->current);
   menu_pad_string (buf, sizeof (buf));
-  wattrset (stdscr, menu->color (menu->current));
-  ADDCOLOR (MT_COLOR_INDICATOR);
-  BKGDSET (MT_COLOR_INDICATOR);
-  CLEARLINE_WIN (menu->current - menu->top + menu->offset);
-  wmove (stdscr, menu->current + menu->offset - menu->top, SW);
+  wattrset (main_w, menu->color (menu->current));
+  ADDCOLOR(main_w, MT_COLOR_INDICATOR);
+  BKGDSET(main_w, MT_COLOR_INDICATOR);
+  CLEARLINE(main_w, menu->current - menu->top + menu->offset);
+  wmove (main_w, menu->current + menu->offset - menu->top, 0);
   print_enriched_string (menu->color (menu->current), (unsigned char *) buf,
                          0);
   print_enriched_string (menu->color (menu->current), (unsigned char *) buf,
                          0);
-  SETCOLOR (MT_COLOR_NORMAL);
-  BKGDSET (MT_COLOR_NORMAL);
+  SETCOLOR(main_w, MT_COLOR_NORMAL);
+  BKGDSET(main_w, MT_COLOR_NORMAL);
 
   menu->redraw &= REDRAW_STATUS;
 }
 
   menu->redraw &= REDRAW_STATUS;
 }
@@ -215,18 +213,18 @@ void menu_redraw_current (MUTTMENU * menu)
 {
   char buf[STRING];
 
 {
   char buf[STRING];
 
-  wmove (stdscr, menu->current + menu->offset - menu->top, SW);
+  wmove (main_w, menu->current + menu->offset - menu->top, 0);
   menu_make_entry (buf, sizeof (buf), menu, menu->current);
   menu_pad_string (buf, sizeof (buf));
 
   menu_make_entry (buf, sizeof (buf), menu, menu->current);
   menu_pad_string (buf, sizeof (buf));
 
-  wattrset (stdscr, menu->color (menu->current));
-  ADDCOLOR (MT_COLOR_INDICATOR);
-  BKGDSET (MT_COLOR_INDICATOR);
-  wclrtoeol (stdscr);
+  wattrset (main_w, menu->color (menu->current));
+  ADDCOLOR(main_w, MT_COLOR_INDICATOR);
+  BKGDSET(main_w, MT_COLOR_INDICATOR);
+  wclrtoeol (main_w);
   print_enriched_string (menu->color (menu->current), (unsigned char *) buf,
                          0);
   print_enriched_string (menu->color (menu->current), (unsigned char *) buf,
                          0);
-  SETCOLOR (MT_COLOR_NORMAL);
-  BKGDSET (MT_COLOR_NORMAL);
+  SETCOLOR(main_w, MT_COLOR_NORMAL);
+  BKGDSET(main_w, MT_COLOR_NORMAL);
 
   menu->redraw &= REDRAW_STATUS;
 }
 
   menu->redraw &= REDRAW_STATUS;
 }
@@ -242,9 +240,9 @@ static void menu_redraw_prompt (MUTTMENU * menu)
     if (*Errorbuf)
       mutt_clear_error ();
 
     if (*Errorbuf)
       mutt_clear_error ();
 
-    SETCOLOR (MT_COLOR_NORMAL);
-    mvwaddstr (stdscr, LINES - 1, 0, menu->prompt);
-    wclrtoeol (stdscr);
+    SETCOLOR(main_w, MT_COLOR_NORMAL);
+    mvwaddstr (main_w, LINES - 1, 0, menu->prompt);
+    wclrtoeol (main_w);
   }
 }
 
   }
 }
 
@@ -523,7 +521,7 @@ MUTTMENU *mutt_new_menu (void)
   p->top = 0;
   p->offset = 1;
   p->redraw = REDRAW_FULL;
   p->top = 0;
   p->offset = 1;
   p->redraw = REDRAW_FULL;
-  p->pagelen = PAGELEN;
+  p->pagelen = LINES - 3;
   p->color = default_color;
   p->search = menu_search_generic;
   return (p);
   p->color = default_color;
   p->search = menu_search_generic;
   return (p);
@@ -688,15 +686,8 @@ int mutt_menuLoop (MUTTMENU * menu)
       return OP_REDRAW;
 
     menu->oldcurrent = menu->current;
       return OP_REDRAW;
 
     menu->oldcurrent = menu->current;
-
-    if (option (OPTBRAILLEFRIENDLY))
-      wmove (stdscr, menu->current - menu->top + menu->offset, SW);
-    else
-      wmove (stdscr, menu->current - menu->top + menu->offset, COLS - 1);
-
     mutt_refresh ();
 
     mutt_refresh ();
 
-
     /* try to catch dialog keys before ops */
     if (menu->dialog && menu_dialog_dokey (menu, &i) == 0)
       return i;
     /* try to catch dialog keys before ops */
     if (menu->dialog && menu_dialog_dokey (menu, &i) == 0)
       return i;
@@ -704,11 +695,11 @@ int mutt_menuLoop (MUTTMENU * menu)
     i = km_dokey (menu->menu);
     if (i == OP_TAG_PREFIX || i == OP_TAG_PREFIX_COND) {
       if (menu->tagged) {
     i = km_dokey (menu->menu);
     if (i == OP_TAG_PREFIX || i == OP_TAG_PREFIX_COND) {
       if (menu->tagged) {
-        mvwaddstr (stdscr, LINES - 1, 0, "Tag-");
-        wclrtoeol (stdscr);
+        mvwaddstr (main_w, LINES - 1, 0, "Tag-");
+        wclrtoeol (main_w);
         i = km_dokey (menu->menu);
         menu->tagprefix = 1;
         i = km_dokey (menu->menu);
         menu->tagprefix = 1;
-        CLEARLINE (LINES - 1);
+        CLEARLINE(main_w, LINES - 1);
       }
       else if (i == OP_TAG_PREFIX) {
         mutt_error _("No tagged entries.");
       }
       else if (i == OP_TAG_PREFIX) {
         mutt_error _("No tagged entries.");
@@ -868,7 +859,7 @@ int mutt_menuLoop (MUTTMENU * menu)
       break;
 
     case OP_REDRAW:
       break;
 
     case OP_REDRAW:
-      clearok (stdscr, TRUE);
+      clearok (main_w, TRUE);
       menu->redraw = REDRAW_FULL;
       break;
 
       menu->redraw = REDRAW_FULL;
       break;
 
index 6f35e48..abf76d7 100644 (file)
@@ -278,7 +278,7 @@ int sidebar_draw(void)
     memset(&blank, ' ', sizeof(blank));
 
     wmove(sw, 0, 0);
     memset(&blank, ' ', sizeof(blank));
 
     wmove(sw, 0, 0);
-    WSETCOLOR(sw, MT_COLOR_STATUS);
+    SETCOLOR(sw, MT_COLOR_STATUS);
     waddnstr(sw, blank, x);
 
     line = 1;
     waddnstr(sw, blank, x);
 
     line = 1;
@@ -286,32 +286,32 @@ int sidebar_draw(void)
         BUFFY *tmp = Incoming.arr[i];
 
         if (i == CurBuffy)
         BUFFY *tmp = Incoming.arr[i];
 
         if (i == CurBuffy)
-            WSETCOLOR(sw, MT_COLOR_INDICATOR);
+            SETCOLOR(sw, MT_COLOR_INDICATOR);
         else if (tmp->new > 0)
         else if (tmp->new > 0)
-            WSETCOLOR(sw, MT_COLOR_NEW);
+            SETCOLOR(sw, MT_COLOR_NEW);
         else if (tmp->msg_flagged > 0)
         else if (tmp->msg_flagged > 0)
-            WSETCOLOR(sw, MT_COLOR_FLAGGED);
+            SETCOLOR(sw, MT_COLOR_FLAGGED);
         else
         else
-            WSETCOLOR(sw, MT_COLOR_NORMAL);
+            SETCOLOR(sw, MT_COLOR_NORMAL);
 
         if (make_sidebar_entry(sw, tmp->path, i, x - 1)) {
 
         if (make_sidebar_entry(sw, tmp->path, i, x - 1)) {
-            WSETCOLOR(sw, MT_COLOR_SIDEBAR);
+            SETCOLOR(sw, MT_COLOR_SIDEBAR);
             waddch(sw, ACS_VLINE);
             line++;
         }
     }
 
     while (line < y - 1) {
             waddch(sw, ACS_VLINE);
             line++;
         }
     }
 
     while (line < y - 1) {
-        WSETCOLOR(sw, MT_COLOR_NORMAL);
+        SETCOLOR(sw, MT_COLOR_NORMAL);
         waddnstr(sw, blank, x - 1);
         waddnstr(sw, blank, x - 1);
-        WSETCOLOR(sw, MT_COLOR_SIDEBAR);
+        SETCOLOR(sw, MT_COLOR_SIDEBAR);
         waddch(sw, ACS_VLINE);
         line++;
     }
 
         waddch(sw, ACS_VLINE);
         line++;
     }
 
-    WSETCOLOR(sw, MT_COLOR_STATUS);
+    SETCOLOR(sw, MT_COLOR_STATUS);
     waddnstr(sw, blank, x);
     waddnstr(sw, blank, x);
-    WSETCOLOR(sw, MT_COLOR_NORMAL);
+    SETCOLOR(sw, MT_COLOR_NORMAL);
     return 0;
 }
 
     return 0;
 }
 
index af9ba33..a6f0211 100644 (file)
@@ -16,8 +16,6 @@
 #include "sort.h"
 #include "buffy.h"
 
 #include "sort.h"
 #include "buffy.h"
 
-#define SW              (option(OPTMBOXPANE)?SidebarWidth:0)
-
 static char *get_sort_str (char *buf, ssize_t buflen, int method)
 {
   snprintf (buf, buflen, "%s%s%s",
 static char *get_sort_str (char *buf, ssize_t buflen, int method)
 {
   snprintf (buf, buflen, "%s%s%s",
@@ -285,5 +283,5 @@ status_format_str(char *buf, ssize_t buflen, char op, const char *src,
 
 void menu_status_line(char* buf, ssize_t len, MUTTMENU* menu, const char* p)
 {
 
 void menu_status_line(char* buf, ssize_t len, MUTTMENU* menu, const char* p)
 {
-    m_strformat(buf, len, COLS - SW, p, status_format_str, menu, 0);
+    m_strformat(buf, len, getmaxx(main_w), p, status_format_str, menu, 0);
 }
 }
diff --git a/mutt.h b/mutt.h
index 24e174d..9b532fc 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -207,7 +207,6 @@ enum {
   OPTAUTOEDIT,
   OPTAUTOTAG,
   OPTBOUNCEDELIVERED,
   OPTAUTOEDIT,
   OPTAUTOTAG,
   OPTBOUNCEDELIVERED,
-  OPTBRAILLEFRIENDLY,
   OPTCHECKNEW,
   OPTCOLLAPSEUNREAD,
   OPTCONFIRMAPPEND,
   OPTCHECKNEW,
   OPTCOLLAPSEUNREAD,
   OPTCONFIRMAPPEND,
index 8ab32c1..b34cede 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -358,7 +358,7 @@ int mutt_save_confirm (const char *s, struct stat *st)
     }
   }
 
     }
   }
 
-  CLEARLINE (LINES - 1);
+  CLEARLINE(main_w, LINES - 1);
   return (ret);
 }
 
   return (ret);
 }
 
diff --git a/pager.c b/pager.c
index 12d86b7..87c075b 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -39,7 +39,6 @@
 #define IsSendAttach(x)  (x && (x)->bdy && !(x)->fp)
 #define IsMsgAttach(x)   (x && (x)->fp && (x)->bdy && (x)->bdy->hdr)
 #define IsHeader(x)      (x && (x)->hdr && !(x)->bdy)
 #define IsSendAttach(x)  (x && (x)->bdy && !(x)->fp)
 #define IsMsgAttach(x)   (x && (x)->fp && (x)->bdy && (x)->bdy->hdr)
 #define IsHeader(x)      (x && (x)->hdr && !(x)->bdy)
-#define SW               (option(OPTMBOXPANE)?SidebarWidth:0)
 
 /* hack to return to position when returning from index to same message */
 static int TopLine = 0;
 
 /* hack to return to position when returning from index to same message */
 static int TopLine = 0;
@@ -149,12 +148,12 @@ resolve_color (struct line_t *lineInfo, int n, int cnt, int flags,
   int search = 0, i, m;
 
   if (!cnt)
   int search = 0, i, m;
 
   if (!cnt)
-    last_color = -1;            /* force wattrset(stdscr) */
+    last_color = -1;            /* force wattrset(main_w) */
 
   if (lineInfo[n].continuation) {
     if (!cnt && option (OPTMARKERS)) {
 
   if (lineInfo[n].continuation) {
     if (!cnt && option (OPTMARKERS)) {
-      SETCOLOR (MT_COLOR_MARKERS);
-      waddch (stdscr, '+');
+      SETCOLOR(main_w, MT_COLOR_MARKERS);
+      waddch(main_w, '+');
       last_color = ColorDefs[MT_COLOR_MARKERS];
     }
     m = (lineInfo[n].syntax)[0].first;
       last_color = ColorDefs[MT_COLOR_MARKERS];
     }
     m = (lineInfo[n].syntax)[0].first;
@@ -246,7 +245,7 @@ resolve_color (struct line_t *lineInfo, int n, int cnt, int flags,
   }
 
   if (color != last_color) {
   }
 
   if (color != last_color) {
-    wattrset (stdscr, color);
+    wattrset(main_w, color);
     last_color = color;
   }
 }
     last_color = color;
   }
 }
@@ -591,7 +590,6 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList,
     return class;
 }
 
     return class;
 }
 
-static int brailleLine = -1;
 static int brailleCol = -1;
 
 static int check_attachment_marker (char *);
 static int brailleCol = -1;
 
 static int check_attachment_marker (char *);
@@ -608,7 +606,6 @@ resolve_types (char *buf, char *rawbuf, struct line_t *lineInfo, int n, int last
     if (n == 0 || ISHEADER (lineInfo[n - 1].type)) {
         if (buf[0] == '\n') {
             lineInfo[n].type = MT_COLOR_NORMAL;
     if (n == 0 || ISHEADER (lineInfo[n - 1].type)) {
         if (buf[0] == '\n') {
             lineInfo[n].type = MT_COLOR_NORMAL;
-            getyx(stdscr, brailleLine, brailleCol);
         }
         else if (n > 0 && (buf[0] == ' ' || buf[0] == '\t')) {
             lineInfo[n].type = lineInfo[n - 1].type;  /* wrapped line */
         }
         else if (n > 0 && (buf[0] == ' ' || buf[0] == '\t')) {
             lineInfo[n].type = lineInfo[n - 1].type;  /* wrapped line */
@@ -903,14 +900,13 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf,
   wchar_t wc;
   mbstate_t mbstate;
 
   wchar_t wc;
   mbstate_t mbstate;
 
-  int wrap_cols = COLS;
+  int wrap_cols = getmaxx(main_w);
 
   if (!(flags & (M_SHOWFLAT)))
     wrap_cols -= WrapMargin;
 
   if (!(flags & (M_SHOWFLAT)))
     wrap_cols -= WrapMargin;
-  wrap_cols -= SW;
 
   if (wrap_cols <= 0)
 
   if (wrap_cols <= 0)
-    wrap_cols = COLS;
+    wrap_cols = getmaxx(main_w);
 
   /* FIXME: this should come from lineInfo */
   p_clear(&mbstate, 1);
 
   /* FIXME: this should come from lineInfo */
   p_clear(&mbstate, 1);
@@ -938,7 +934,7 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf,
         break;
       col += 4;
       if (pa)
         break;
       col += 4;
       if (pa)
-        wprintw (stdscr, "\\%03o", buf[ch]);
+        wprintw(main_w, "\\%03o", buf[ch]);
       k = 1;
       continue;
     }
       k = 1;
       continue;
     }
@@ -991,7 +987,7 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf,
         break;
       col += t;
       if (pa)
         break;
       col += t;
       if (pa)
-        mutt_addwch (wc);
+        waddwch(main_w, wc);
     }
     else if (wc == '\n')
       break;
     }
     else if (wc == '\n')
       break;
@@ -1002,7 +998,7 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf,
         break;
       if (pa)
         for (; col < t; col++)
         break;
       if (pa)
         for (; col < t; col++)
-          waddch (stdscr, ' ');
+          waddch(main_w, ' ');
       else
         col = t;
     }
       else
         col = t;
     }
@@ -1011,20 +1007,20 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf,
         break;
       col += 2;
       if (pa)
         break;
       col += 2;
       if (pa)
-        wprintw (stdscr, "^%c", ('@' + wc) & 0x7f);
+        wprintw(main_w, "^%c", ('@' + wc) & 0x7f);
     }
     else if (wc < 0x100) {
       if (col + 4 > wrap_cols)
         break;
       col += 4;
       if (pa)
     }
     else if (wc < 0x100) {
       if (col + 4 > wrap_cols)
         break;
       col += 4;
       if (pa)
-        wprintw (stdscr, "\\%03o", wc);
+        wprintw(main_w, "\\%03o", wc);
     } else {
       if (col + 1 > wrap_cols)
         break;
       ++col;
       if (pa)
     } else {
       if (col + 1 > wrap_cols)
         break;
       ++col;
       if (pa)
-        waddch (stdscr, CharsetReplacement);
+        waddch(main_w, CharsetReplacement);
     }
   }
   *pspace = space;
     }
   }
   *pspace = space;
@@ -1230,12 +1226,12 @@ display_line (FILE * f, off_t *last_pos, struct line_t **lineInfo, int n,
   format_line (lineInfo, n, buf, flags, &a, cnt, &ch, &vch, &col, &special);
 
   /* end the last color pattern (needed by S-Lang) */
   format_line (lineInfo, n, buf, flags, &a, cnt, &ch, &vch, &col, &special);
 
   /* end the last color pattern (needed by S-Lang) */
-  if (special || (col != COLS && (flags & (M_SHOWCOLOR | M_SEARCH))))
-    resolve_color (*lineInfo, n, vch, flags, 0, &a);
+  if (special || (col != getmaxx(main_w) && (flags & (M_SHOWCOLOR | M_SEARCH))))
+    resolve_color(*lineInfo, n, vch, flags, 0, &a);
 
   /*
    * Fill the blank space at the end of the line with the prevailing color.
 
   /*
    * Fill the blank space at the end of the line with the prevailing color.
-   * ncurses does an implicit wclrtoeol(stdscr) when you do waddch(stdscr,
+   * ncurses does an implicit wclrtoeol(main_w) when you do waddch(main_w,
    * '\n') so we have to make sure to reset the color *after* that
    */
   if (flags & M_SHOWCOLOR) {
    * '\n') so we have to make sure to reset the color *after* that
    */
   if (flags & M_SHOWCOLOR) {
@@ -1245,19 +1241,19 @@ display_line (FILE * f, off_t *last_pos, struct line_t **lineInfo, int n,
     else
       def_color = ColorDefs[(*lineInfo)[m].type];
 
     else
       def_color = ColorDefs[(*lineInfo)[m].type];
 
-    wattrset (stdscr, def_color);
-    wbkgdset (stdscr, def_color | ' ');
+    wattrset(main_w, def_color);
+    wbkgdset(main_w, def_color | ' ');
   }
   }
-  waddch (stdscr, '\n');
+  waddch(main_w, '\n');
 
   /*
    * reset the color back to normal.  This *must* come after the
 
   /*
    * reset the color back to normal.  This *must* come after the
-   * waddch(stdscr, '\n'), otherwise the color for this line will not be
+   * waddch(main_w, '\n'), otherwise the color for this line will not be
    * filled to the right margin.
    */
   if (flags & M_SHOWCOLOR) {
    * filled to the right margin.
    */
   if (flags & M_SHOWCOLOR) {
-    SETCOLOR (MT_COLOR_NORMAL);
-    BKGDSET (MT_COLOR_NORMAL);
+    SETCOLOR(main_w, MT_COLOR_NORMAL);
+    BKGDSET(main_w, MT_COLOR_NORMAL);
   }
 
   /* build a return code */
   }
 
   /* build a return code */
@@ -1355,10 +1351,10 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
     imap_keepalive ();
 
     if (redraw & REDRAW_FULL) {
     imap_keepalive ();
 
     if (redraw & REDRAW_FULL) {
-      SETCOLOR (MT_COLOR_NORMAL);
-      /* wclear(stdscr) doesn't optimize screen redraws */
-      wmove (stdscr, 0, 0);
-      wclrtobot (stdscr);
+      SETCOLOR(main_w, MT_COLOR_NORMAL);
+      /* wclear(main_w) doesn't optimize screen redraws */
+      wmove(main_w, 0, 0);
+      wclrtobot(main_w);
 
       if (IsHeader (extra) && Context->vcount + 1 < PagerIndexLines)
         indexlen = Context->vcount + 1;
 
       if (IsHeader (extra) && Context->vcount + 1 < PagerIndexLines)
         indexlen = Context->vcount + 1;
@@ -1381,10 +1377,10 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
         bodylen = statusoffset - bodyoffset;
       }
 
         bodylen = statusoffset - bodyoffset;
       }
 
-      SETCOLOR (MT_COLOR_STATUS);
-      wmove (stdscr, helpoffset, SW);
-      mutt_paddstr (COLS-SW, "");
-      SETCOLOR (MT_COLOR_NORMAL);
+      SETCOLOR(main_w, MT_COLOR_STATUS);
+      wmove(main_w, helpoffset, 0);
+      mutt_paddstr(main_w, getmaxx(main_w), "");
+      SETCOLOR(main_w, MT_COLOR_NORMAL);
 
       if (Resize != NULL) {
         if ((SearchCompiled = Resize->SearchCompiled)) {
 
       if (Resize != NULL) {
         if ((SearchCompiled = Resize->SearchCompiled)) {
@@ -1411,7 +1407,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
           pager_index->current = extra->hdr->virtual;
         }
 
           pager_index->current = extra->hdr->virtual;
         }
 
-        SETCOLOR (MT_COLOR_NORMAL);
+        SETCOLOR(main_w, MT_COLOR_NORMAL);
         pager_index->offset = indexoffset + (option (OPTSTATUSONTOP) ? 1 : 0);
 
         pager_index->pagelen = indexlen - 1;
         pager_index->offset = indexoffset + (option (OPTSTATUSONTOP) ? 1 : 0);
 
         pager_index->pagelen = indexlen - 1;
@@ -1448,7 +1444,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
 
     if ((redraw & REDRAW_BODY) || topline != oldtopline) {
       do {
 
     if ((redraw & REDRAW_BODY) || topline != oldtopline) {
       do {
-        wmove (stdscr, bodyoffset, SW);
+        wmove(main_w, bodyoffset, 0);
         curline = oldtopline = topline;
         lines = 0;
         force_redraw = 0;
         curline = oldtopline = topline;
         lines = 0;
         force_redraw = 0;
@@ -1461,21 +1457,21 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
                             &SearchRE) > 0)
             lines++;
           curline++;
                             &SearchRE) > 0)
             lines++;
           curline++;
-          wmove (stdscr, lines + bodyoffset, SW);
+          wmove(main_w, lines + bodyoffset, 0);
           redraw |= REDRAW_SIDEBAR;
         }
         last_offset = lineInfo[curline].offset;
       } while (force_redraw);
 
           redraw |= REDRAW_SIDEBAR;
         }
         last_offset = lineInfo[curline].offset;
       } while (force_redraw);
 
-      SETCOLOR (MT_COLOR_TILDE);
-      BKGDSET (MT_COLOR_TILDE);
+      SETCOLOR(main_w, MT_COLOR_TILDE);
+      BKGDSET(main_w, MT_COLOR_TILDE);
       while (lines < bodylen) {
       while (lines < bodylen) {
-        wclrtoeol (stdscr);
+        wclrtoeol(main_w);
         if (option (OPTTILDE))
         if (option (OPTTILDE))
-          waddch (stdscr, '~');
-        waddch (stdscr, '\n');
+          waddch(main_w, '~');
+        waddch(main_w, '\n');
         lines++;
         lines++;
-        wmove (stdscr, lines + bodyoffset, SW);
+        wmove(main_w, lines + bodyoffset, 0);
       }
       /* We are going to update the pager status bar, so it isn't
        * necessary to reset to normal color now. */
       }
       /* We are going to update the pager status bar, so it isn't
        * necessary to reset to normal color now. */
@@ -1485,34 +1481,35 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
 
     if (redraw & REDRAW_STATUS) {
       /* print out the pager status bar */
 
     if (redraw & REDRAW_STATUS) {
       /* print out the pager status bar */
-      SETCOLOR (MT_COLOR_STATUS);
-      BKGDSET (MT_COLOR_STATUS);
-      CLEARLINE_WIN (statusoffset);
+      SETCOLOR(main_w, MT_COLOR_STATUS);
+      BKGDSET(main_w, MT_COLOR_STATUS);
+      wmove(main_w, statusoffset, 0);
+      wclrtoeol(main_w);
       if (IsHeader (extra)) {
       if (IsHeader (extra)) {
-        size_t l1 = (COLS - 9) * MB_LEN_MAX;
+        size_t l1 = (getmaxx(main_w) - 9) * MB_LEN_MAX;
         size_t l2 = sizeof (buffer);
 
         _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
                            Context, extra->hdr, M_FORMAT_MAKEPRINT);
       }
       else if (IsMsgAttach (extra)) {
         size_t l2 = sizeof (buffer);
 
         _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
                            Context, extra->hdr, M_FORMAT_MAKEPRINT);
       }
       else if (IsMsgAttach (extra)) {
-        size_t l1 = (COLS - 9) * MB_LEN_MAX;
+        size_t l1 = (getmaxx(main_w) - 9) * MB_LEN_MAX;
         size_t l2 = sizeof (buffer);
 
         _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
                            Context, extra->bdy->hdr, M_FORMAT_MAKEPRINT);
       }
         size_t l2 = sizeof (buffer);
 
         _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
                            Context, extra->bdy->hdr, M_FORMAT_MAKEPRINT);
       }
-      wmove(stdscr, statusoffset,SW);
-      mutt_paddstr (COLS - 10 - SW, IsHeader (extra) || 
-                    IsMsgAttach (extra) ? buffer : banner);
+      wmove(main_w, statusoffset, 0);
+      mutt_paddstr(main_w, getmaxx(main_w) - 10,
+                   IsHeader(extra) || IsMsgAttach(extra) ? buffer : banner);
 
 
-      waddstr (stdscr, " -- (");
+      waddstr(main_w, " -- (");
       if (last_pos < sb.st_size - 1)
       if (last_pos < sb.st_size - 1)
-        wprintw (stdscr, "%d%%)", (int) (100 * last_offset / sb.st_size));
+        wprintw(main_w, "%d%%)", (int) (100 * last_offset / sb.st_size));
       else
       else
-        waddstr (stdscr, topline == 0 ? "all)" : "end)");
-      BKGDSET (MT_COLOR_NORMAL);
-      SETCOLOR (MT_COLOR_NORMAL);
+        waddstr(main_w, topline == 0 ? "all)" : "end)");
+      BKGDSET(main_w, MT_COLOR_NORMAL);
+      SETCOLOR(main_w, MT_COLOR_NORMAL);
     }
 
     if (redraw & REDRAW_SIDEBAR)
     }
 
     if (redraw & REDRAW_SIDEBAR)
@@ -1525,27 +1522,19 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
       sidebar_draw ();
       /* print out the pager_index status bar */
       menu_status_line (buffer, sizeof (buffer), pager_index, NONULL (Status));
       sidebar_draw ();
       /* print out the pager_index status bar */
       menu_status_line (buffer, sizeof (buffer), pager_index, NONULL (Status));
-      wmove (stdscr, indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), SW);
-      SETCOLOR (MT_COLOR_STATUS);
-      BKGDSET (MT_COLOR_STATUS);
-      mutt_paddstr (COLS-SW, buffer);
-      SETCOLOR (MT_COLOR_NORMAL);
-      BKGDSET (MT_COLOR_NORMAL);
+      wmove(main_w, indexoffset + (option(OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0);
+      SETCOLOR(main_w, MT_COLOR_STATUS);
+      BKGDSET(main_w, MT_COLOR_STATUS);
+      mutt_paddstr(main_w, getmaxx(main_w), buffer);
+      SETCOLOR(main_w, MT_COLOR_NORMAL);
+      BKGDSET(main_w, MT_COLOR_NORMAL);
     }
     /* if we're not using the index, update every time */
     if (index == 0)
       sidebar_draw ();
 
     redraw = 0;
     }
     /* if we're not using the index, update every time */
     if (index == 0)
       sidebar_draw ();
 
     redraw = 0;
-
-    if (option(OPTBRAILLEFRIENDLY)) {
-      if (brailleLine!=-1) {
-        wmove(stdscr, brailleLine+1, 0);
-        brailleLine = -1;
-      }
-    } else
-      wmove (stdscr, statusoffset, COLS-1);
-    mutt_refresh ();
+    mutt_refresh();
 
     if (IsHeader (extra) && OldHdr == extra->hdr && TopLine != topline
         && lineInfo[curline].offset < sb.st_size-1) {
 
     if (IsHeader (extra) && OldHdr == extra->hdr && TopLine != topline
         && lineInfo[curline].offset < sb.st_size-1) {
@@ -1920,7 +1909,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
       break;
 
     case OP_REDRAW:
       break;
 
     case OP_REDRAW:
-      clearok (stdscr, TRUE);
+      clearok(main_w, TRUE);
       redraw = REDRAW_FULL;
       break;
 
       redraw = REDRAW_FULL;
       break;
 
index ba30804..91d6434 100644 (file)
@@ -25,8 +25,6 @@
 #include "attach.h"
 #include "copy.h"
 
 #include "attach.h"
 #include "copy.h"
 
-#define SW    (option(OPTMBOXPANE)?SidebarWidth:0)
-
 void mutt_update_tree (ATTACHPTR ** idx, short idxlen)
 {
   char buf[STRING];
 void mutt_update_tree (ATTACHPTR ** idx, short idxlen)
 {
   char buf[STRING];
@@ -306,7 +304,7 @@ mutt_attach_fmt(char *dest, ssize_t destlen, char op, const char *src,
 
 static void attach_entry(char *b, ssize_t blen, MUTTMENU * menu, int num)
 {
 
 static void attach_entry(char *b, ssize_t blen, MUTTMENU * menu, int num)
 {
-    m_strformat(b, blen, COLS - SW, AttachFormat, mutt_attach_fmt,
+    m_strformat(b, blen, getmaxx(main_w), AttachFormat, mutt_attach_fmt,
                 ((ATTACHPTR **) menu->data)[num], 0);
 }
 
                 ((ATTACHPTR **) menu->data)[num], 0);
 }
 
@@ -486,7 +484,7 @@ mutt_query_pipe_attachment(char *command, FILE * fp, BODY * body, int afilter)
              _("WARNING!  You are about to overwrite %s, continue?"),
              body->filename);
     if (mutt_yesorno (warning, M_NO) != M_YES) {
              _("WARNING!  You are about to overwrite %s, continue?"),
              body->filename);
     if (mutt_yesorno (warning, M_NO) != M_YES) {
-      CLEARLINE (LINES - 1);
+      CLEARLINE(main_w, LINES - 1);
       return;
     }
     tempfd = m_tempfd(tfile, sizeof(tfile), NONULL(mod_core.tmpdir), NULL);
       return;
     }
     tempfd = m_tempfd(tfile, sizeof(tfile), NONULL(mod_core.tmpdir), NULL);
index 1f46204..d3059ff 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -163,9 +163,9 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr __attribute__ ((unused)),
             buf);
 
 #define extra_space (15+7+2)
             buf);
 
 #define extra_space (15+7+2)
-  if (m_strwidth(prompt) > COLS - extra_space) {
-    mutt_format_string (prompt, sizeof (prompt) - 4,
-                        0, COLS - extra_space, 0, 0,
+  if (m_strwidth(prompt) > getmaxx(main_w) - extra_space) {
+    mutt_format_string (prompt, sizeof (prompt) - 4, 0,
+                        getmaxx(main_w) - extra_space, 0, 0,
                         prompt, sizeof (prompt), 0);
     m_strcat(prompt, sizeof(prompt), "...?");
   } else {
                         prompt, sizeof (prompt), 0);
     m_strcat(prompt, sizeof(prompt), "...?");
   } else {
@@ -175,12 +175,12 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr __attribute__ ((unused)),
 
   if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
     address_list_wipe(&adr);
 
   if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
     address_list_wipe(&adr);
-    CLEARLINE (LINES - 1);
+    CLEARLINE(main_w, LINES - 1);
     mutt_message (p ? _("Message not bounced.") : _("Messages not bounced."));
     return;
   }
 
     mutt_message (p ? _("Message not bounced.") : _("Messages not bounced."));
     return;
   }
 
-  CLEARLINE (LINES - 1);
+  CLEARLINE(main_w, LINES - 1);
 
   if (cur)
     ret = mutt_bounce_message (fp, cur->hdr, adr);
 
   if (cur)
     ret = mutt_bounce_message (fp, cur->hdr, adr);