Updates for the remailer. -- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA http://www.8t8.us/configs/gpg-key-transition-statement.txt
# HG changeset patch # User Kevin McCarthy <ke...@8t8.us> # Date 1461374852 25200 # Fri Apr 22 18:27:32 2016 -0700 # Node ID 57c2eff41c049fc9b018f6fd5e623b3fc6aea698 # Parent 28bc86597f5ee2675df062700482a0b665050783 Change remailer to use mutt windows.
diff --git a/remailer.c b/remailer.c --- a/remailer.c +++ b/remailer.c @@ -216,18 +216,18 @@ for (i = 0; type2_list[i]; i++) mix_free_remailer (&type2_list[i]); FREE (type2_list); /* __FREE_CHECKED__ */ } #define MIX_HOFFSET 2 -#define MIX_VOFFSET (LINES - 6) -#define MIX_MAXROW (LINES - 3) +#define MIX_VOFFSET (MuttIndexWindow->rows - 4) +#define MIX_MAXROW (MuttIndexWindow->rows - 1) static void mix_screen_coordinates (REMAILER **type2_list, struct coord **coordsp, MIXCHAIN *chain, int i) { short c, r, oc; @@ -252,17 +252,17 @@ } for (; i < chain->cl; i++) { oc = c; c += strlen (type2_list[chain->ch[i]]->shortname) + 2; - if (c >= COLS) + if (c >= MuttIndexWindow->cols) { oc = c = MIX_HOFFSET; r++; } coords[i].c = oc; coords[i].r = r; @@ -282,46 +282,48 @@ if (coords[i].r < MIX_MAXROW) { if (selected) SETCOLOR (MT_COLOR_INDICATOR); else NORMAL_COLOR; - mvaddstr (coords[i].r, coords[i].c, type2_list[chain->ch[i]]->shortname); + mutt_window_mvaddstr (MuttIndexWindow, coords[i].r, coords[i].c, + type2_list[chain->ch[i]]->shortname); NORMAL_COLOR; if (i + 1 < chain->cl) addstr (", "); } } static void mix_redraw_chain (REMAILER **type2_list, struct coord *coords, MIXCHAIN *chain, int cur) { int i; for (i = MIX_VOFFSET; i < MIX_MAXROW; i++) { - move (i, 0); - clrtoeol (); + mutt_window_move (MuttIndexWindow, i, 0); + mutt_window_clrtoeol (MuttIndexWindow); } for (i = 0; i < chain->cl; i++) mix_redraw_ce (type2_list, coords, chain, i, i == cur); } static void mix_redraw_head (MIXCHAIN *chain) { SETCOLOR (MT_COLOR_STATUS); - mvprintw (MIX_VOFFSET - 1, 0, "-- Remailer chain [Length: %d]", chain ? chain->cl : 0); - clrtoeol (); + mutt_window_mvprintw (MuttIndexWindow, MIX_VOFFSET - 1, 0, + "-- Remailer chain [Length: %d]", chain ? chain->cl : 0); + mutt_window_clrtoeol (MuttIndexWindow); NORMAL_COLOR; } static const char *mix_format_caps (REMAILER *r) { static char capbuff[10]; char *t = capbuff; @@ -484,17 +486,16 @@ }; void mix_make_chain (LIST **chainp, int *redraw) { LIST *p; MIXCHAIN *chain; int c_cur = 0, c_old = 0; - int m_len; short c_redraw = 1; REMAILER **type2_list = NULL; size_t ttll = 0; struct coord *coords = NULL; MUTTMENU *menu; @@ -530,24 +531,23 @@ menu = mutt_new_menu (MENU_MIX); menu->max = ttll; menu->make_entry = mix_entry; menu->tag = NULL; menu->title = _("Select a remailer chain."); menu->data = type2_list; menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MIX, RemailerHelp); - - m_len = menu->pagelen = MIX_VOFFSET - menu->offset - 1; + menu->pagelen = MIX_VOFFSET - 1; while (loop) { - if (menu->pagelen != m_len) + if (menu->pagelen != MIX_VOFFSET - 1) { - menu->pagelen = m_len; + menu->pagelen = MIX_VOFFSET - 1; menu->redraw = REDRAW_FULL; } if (c_redraw) { mix_redraw_head (chain); mix_redraw_chain (type2_list, coords, chain, c_cur); c_redraw = 0; @@ -563,17 +563,17 @@ switch ((op = mutt_menuLoop (menu))) { case OP_REDRAW: { menu_redraw_status (menu); mix_redraw_head (chain); mix_screen_coordinates (type2_list, &coords, chain, 0); mix_redraw_chain (type2_list, coords, chain, c_cur); - menu->pagelen = m_len = MIX_VOFFSET - menu->offset - 1; + menu->pagelen = MIX_VOFFSET - 1; break; } case OP_EXIT: { chain->cl = 0; loop = 0; break;
signature.asc
Description: PGP signature