From: Pierre Habouzit Date: Thu, 24 May 2007 22:20:40 +0000 (+0200) Subject: byebye OPTARROWCURSOR X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=c50162101b316e88b95dc4259d45a259b38a972e;p=apps%2Fmadmutt.git byebye OPTARROWCURSOR Signed-off-by: Pierre Habouzit --- diff --git a/alias.cpkg b/alias.cpkg index 7342c31..d11d899 100644 --- a/alias.cpkg +++ b/alias.cpkg @@ -617,8 +617,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) { m_strformat(s, slen, COLS - SW, MAlias.alias_format, alias_format_str, - ((alias_t **)m->data)[num], - option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); + ((alias_t **)m->data)[num], 0); } static int alias_tag (MUTTMENU * menu, int n, int m) diff --git a/browser.c b/browser.c index 43608e7..4ba6e19 100644 --- a/browser.c +++ b/browser.c @@ -639,12 +639,12 @@ static void folder_entry (char *s, ssize_t slen, MUTTMENU * menu, int num) #ifdef USE_NNTP if (option (OPTNEWS)) - m_strformat(s, slen, COLS - SW, GroupFormat, newsgroup_format_str, &folder, - option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); + m_strformat(s, slen, COLS - SW, GroupFormat, newsgroup_format_str, + &folder, 0); else #endif - m_strformat(s, slen, COLS - SW, FolderFormat, folder_format_str, &folder, - option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); + m_strformat(s, slen, COLS - SW, FolderFormat, folder_format_str, + &folder, 0); } static void init_menu (struct browser_state *state, MUTTMENU * menu, diff --git a/compose.c b/compose.c index 0c9802a..031fdab 100644 --- a/compose.c +++ b/compose.c @@ -114,8 +114,7 @@ static struct mapping_t ComposeNewsHelp[] = { static void snd_entry (char *b, ssize_t blen, MUTTMENU * menu, int num) { m_strformat(b, blen, COLS - SW, AttachFormat, mutt_attach_fmt, - ((ATTACHPTR **)menu->data)[num], - M_FORMAT_STAT_FILE | (option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0)); + ((ATTACHPTR **)menu->data)[num], M_FORMAT_STAT_FILE); } static void redraw_crypt_lines (HEADER * msg) diff --git a/crypt.cpkg b/crypt.cpkg index b22723f..b140ddf 100644 --- a/crypt.cpkg +++ b/crypt.cpkg @@ -2270,7 +2270,7 @@ static void crypt_entry (char *s, ssize_t l, MUTTMENU * menu, int num) entry.num = num + 1; m_strformat(s, l, COLS - SW, mod_crypt.pgp_entry_format, crypt_entry_fmt, - &entry, option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); + &entry, 0); } /* Compare two addresses and the keyid to be used for sorting. */ diff --git a/init.h b/init.h index a7a1be2..648e0c5 100644 --- a/init.h +++ b/init.h @@ -134,15 +134,6 @@ struct option_t MuttVars[] = { ** message could include a line like ``\fT[-- PGP output follows ...\fP" and ** give it the same color as your attachment color. */ - {"arrow_cursor", DT_BOOL, R_BOTH, OPTARROWCURSOR, "no" }, - /* - ** .pp - ** When \fIset\fP, an arrow (``\fT->\fP'') will be used to indicate the current entry - ** in menus instead of highlighting the whole line. On slow network or modem - ** links this will make response faster because there is less that has to - ** be redrawn on the screen when moving to the next or previous entries - ** in the menu. - */ {"ascii_chars", DT_BOOL, R_BOTH, OPTASCIICHARS, "no" }, /* ** .pp diff --git a/lib-lib/str.c b/lib-lib/str.c index 30198aa..604628d 100644 --- a/lib-lib/str.c +++ b/lib-lib/str.c @@ -263,9 +263,10 @@ ssize_t m_strwidth (const char *s) ssize_t m_strformat(char *dst, ssize_t dlen, int width, const char *fmt, format_t *callback, anytype cdata, format_flag flags) { - ssize_t pos = flags & M_FORMAT_ARROWCURSOR ? 3 : 0; + ssize_t pos = 0; - m_strpad(dst, dlen, '\0', pos + 1); + if (dlen) + *dst = '\0'; if (!fmt) return pos; diff --git a/lib-lib/str.h b/lib-lib/str.h index 86fd758..d455666 100644 --- a/lib-lib/str.h +++ b/lib-lib/str.h @@ -400,8 +400,7 @@ typedef enum { M_FORMAT_MAKEPRINT = (1 << 2), /* make sure that all chars are printable */ M_FORMAT_OPTIONAL = (1 << 3), M_FORMAT_STAT_FILE = (1 << 4), /* used by mutt_attach_fmt */ - M_FORMAT_ARROWCURSOR = (1 << 5), /* reserve space for arrow_cursor */ - M_FORMAT_INDEX = (1 << 6) /* this is a main index entry */ + M_FORMAT_INDEX = (1 << 6), /* this is a main index entry */ } format_flag; typedef const char * diff --git a/lib-ui/curs_main.c b/lib-ui/curs_main.c index d83f1bf..dc19bf5 100644 --- a/lib-ui/curs_main.c +++ b/lib-ui/curs_main.c @@ -98,9 +98,6 @@ void index_make_entry (char *s, ssize_t l, struct menu_t * menu, int num) HEADER *h = Context->hdrs[Context->v2r[num]]; THREAD *tmp; - if (option(OPTARROWCURSOR)) - flag |= M_FORMAT_ARROWCURSOR; - if ((Sort & SORT_MASK) == SORT_THREADS && h->tree) { flag |= M_FORMAT_TREE; /* display the thread tree */ if (h->display_subject) @@ -560,9 +557,7 @@ int mutt_index_menu (void) else menu->oldcurrent = -1; - if (option (OPTARROWCURSOR)) - move (menu->current - menu->top + menu->offset, 2); - else if (option (OPTBRAILLEFRIENDLY)) + if (option (OPTBRAILLEFRIENDLY)) move (menu->current - menu->top + menu->offset, 0); else move (menu->current - menu->top + menu->offset, COLS - 1); diff --git a/lib-ui/menu.c b/lib-ui/menu.c index 01f0ab8..ddcccf5 100644 --- a/lib-ui/menu.c +++ b/lib-ui/menu.c @@ -138,11 +138,9 @@ static void menu_make_entry (char *s, int l, MUTTMENU * menu, int i) static void menu_pad_string (char *s, size_t n) { - int shift = option (OPTARROWCURSOR) ? 3 : 0; - int cols; + int cols = COLS - SW; char *tmpbuf = p_new(char, n); - cols = COLS - SW - shift; mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, m_strlen(s), 1); tmpbuf[n - 1] = 0; snprintf (s, n, "%s", tmpbuf); /* overkill */ @@ -199,47 +197,23 @@ void menu_redraw_index (MUTTMENU * menu) menu_make_entry (buf, sizeof (buf), menu, i); menu_pad_string (buf, sizeof (buf)); - if (option (OPTARROWCURSOR)) { - attrset (menu->color (i)); - CLEARLINE_WIN (i - menu->top + menu->offset); + attrset (menu->color (i)); - if (i == menu->current) { - attrset (menu->color (i)); - ADDCOLOR (MT_COLOR_INDICATOR); - BKGDSET (MT_COLOR_INDICATOR); - addstr ("->"); - attrset (menu->color (i)); - addch (' '); - } - else { - attrset (menu->color (i)); - move (i - menu->top + menu->offset, SW); - addstr (" "); - } - - print_enriched_string (menu->color (i), (unsigned char *) buf, 1); - SETCOLOR (MT_COLOR_NORMAL); - BKGDSET (MT_COLOR_NORMAL); + if (i == menu->current) { + ADDCOLOR (MT_COLOR_INDICATOR); + BKGDSET (MT_COLOR_INDICATOR); } - else { - attrset (menu->color (i)); - - if (i == menu->current) { - ADDCOLOR (MT_COLOR_INDICATOR); - BKGDSET (MT_COLOR_INDICATOR); - } - CLEARLINE_WIN (i - menu->top + menu->offset); + CLEARLINE_WIN (i - menu->top + menu->offset); - move (i - menu->top + menu->offset, SW); - print_enriched_string (menu->color (i), (unsigned char *) buf, - i != menu->current); - SETCOLOR (MT_COLOR_NORMAL); - BKGDSET (MT_COLOR_NORMAL); - } - } - else + move (i - menu->top + menu->offset, SW); + print_enriched_string (menu->color (i), (unsigned char *) buf, + i != menu->current); + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); + } else { CLEARLINE_WIN (i - menu->top + menu->offset); + } } sidebar_draw (); @@ -259,50 +233,27 @@ void menu_redraw_motion (MUTTMENU * menu) SETCOLOR (MT_COLOR_NORMAL); BKGDSET (MT_COLOR_NORMAL); - if (option (OPTARROWCURSOR)) { - /* clear the pointer */ - attrset (menu->color (menu->oldcurrent)); - addstr (" "); + /* erase the current indicator */ + attrset (menu->color (menu->oldcurrent)); + clrtoeol (); + menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); + menu_pad_string (buf, sizeof (buf)); + print_enriched_string (menu->color (menu->oldcurrent), + (unsigned char *) buf, 1); - if (menu->redraw & REDRAW_MOTION_RESYNCH) { - clrtoeol (); - menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); - menu_pad_string (buf, sizeof (buf)); - move (menu->oldcurrent + menu->offset - menu->top, SW + 3); - print_enriched_string (menu->color (menu->oldcurrent), - (unsigned char *) buf, 1); - SETCOLOR (MT_COLOR_NORMAL); - } + /* now draw the new one to reflect the change */ + menu_make_entry (buf, sizeof (buf), menu, menu->current); + menu_pad_string (buf, sizeof (buf)); + attrset (menu->color (menu->current)); + ADDCOLOR (MT_COLOR_INDICATOR); + BKGDSET (MT_COLOR_INDICATOR); + CLEARLINE_WIN (menu->current - menu->top + menu->offset); + move (menu->current + menu->offset - menu->top, SW); + print_enriched_string (menu->color (menu->current), (unsigned char *) buf, + 0); + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); - /* now draw it in the new location */ - move (menu->current + menu->offset - menu->top, SW); - attrset (menu->color (menu->current)); - ADDCOLOR (MT_COLOR_INDICATOR); - addstr ("->"); - SETCOLOR (MT_COLOR_NORMAL); - } - else { - /* erase the current indicator */ - attrset (menu->color (menu->oldcurrent)); - clrtoeol (); - menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); - menu_pad_string (buf, sizeof (buf)); - print_enriched_string (menu->color (menu->oldcurrent), - (unsigned char *) buf, 1); - - /* now draw the new one to reflect the change */ - menu_make_entry (buf, sizeof (buf), menu, menu->current); - menu_pad_string (buf, sizeof (buf)); - attrset (menu->color (menu->current)); - ADDCOLOR (MT_COLOR_INDICATOR); - BKGDSET (MT_COLOR_INDICATOR); - CLEARLINE_WIN (menu->current - menu->top + menu->offset); - move (menu->current + menu->offset - menu->top, SW); - print_enriched_string (menu->color (menu->current), (unsigned char *) buf, - 0); - SETCOLOR (MT_COLOR_NORMAL); - BKGDSET (MT_COLOR_NORMAL); - } menu->redraw &= REDRAW_STATUS; } @@ -314,31 +265,15 @@ void menu_redraw_current (MUTTMENU * menu) menu_make_entry (buf, sizeof (buf), menu, menu->current); menu_pad_string (buf, sizeof (buf)); - if (option (OPTARROWCURSOR)) { - int attr = menu->color (menu->current); + attrset (menu->color (menu->current)); + ADDCOLOR (MT_COLOR_INDICATOR); + BKGDSET (MT_COLOR_INDICATOR); + clrtoeol (); + print_enriched_string (menu->color (menu->current), (unsigned char *) buf, + 0); + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); - attrset (attr); - clrtoeol (); - attrset (menu->color (menu->current)); - ADDCOLOR (MT_COLOR_INDICATOR); - addstr ("->"); - attrset (attr); - addch (' '); - menu_pad_string (buf, sizeof (buf)); - print_enriched_string (menu->color (menu->current), (unsigned char *) buf, - 1); - SETCOLOR (MT_COLOR_NORMAL); - } - else { - attrset (menu->color (menu->current)); - ADDCOLOR (MT_COLOR_INDICATOR); - BKGDSET (MT_COLOR_INDICATOR); - clrtoeol (); - print_enriched_string (menu->color (menu->current), (unsigned char *) buf, - 0); - SETCOLOR (MT_COLOR_NORMAL); - BKGDSET (MT_COLOR_NORMAL); - } menu->redraw &= REDRAW_STATUS; } @@ -800,9 +735,7 @@ int mutt_menuLoop (MUTTMENU * menu) menu->oldcurrent = menu->current; - if (option (OPTARROWCURSOR)) - move (menu->current - menu->top + menu->offset, SW + 2); - else if (option (OPTBRAILLEFRIENDLY)) + if (option (OPTBRAILLEFRIENDLY)) move (menu->current - menu->top + menu->offset, SW); else move (menu->current - menu->top + menu->offset, COLS - 1); diff --git a/mutt.h b/mutt.h index 25e5613..9b1d54e 100644 --- a/mutt.h +++ b/mutt.h @@ -200,7 +200,6 @@ enum { enum { OPTALLOW8BIT, OPTALLOWANSI, - OPTARROWCURSOR, OPTASCIICHARS, OPTASKBCC, OPTASKCC, diff --git a/postpone.c b/postpone.c index 68857c2..8a7719b 100644 --- a/postpone.c +++ b/postpone.c @@ -132,10 +132,8 @@ void mutt_update_num_postponed (void) static void post_entry (char *s, ssize_t slen, MUTTMENU * menu, int entry) { - CONTEXT *ctx = (CONTEXT *) menu->data; - - _mutt_make_string (s, slen, NONULL (HdrFmt), ctx, ctx->hdrs[entry], - option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); + CONTEXT *ctx = (CONTEXT *)menu->data; + _mutt_make_string(s, slen, NONULL (HdrFmt), ctx, ctx->hdrs[entry], 0); } static HEADER *select_msg (void) diff --git a/recvattach.c b/recvattach.c index 2a88f4e..82aa139 100644 --- a/recvattach.c +++ b/recvattach.c @@ -186,8 +186,7 @@ mutt_attach_fmt(char *dest, ssize_t destlen, char op, const char *src, char s[STRING]; _mutt_make_string (s, sizeof (s), MsgFmt, NULL, aptr->content->hdr, - M_FORMAT_FORCESUBJ | M_FORMAT_MAKEPRINT | - (option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0)); + M_FORMAT_FORCESUBJ | M_FORMAT_MAKEPRINT); if (*s) { mutt_format_s (dest, destlen, prefix, s); break; @@ -317,8 +316,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) { m_strformat(b, blen, COLS - SW, AttachFormat, mutt_attach_fmt, - ((ATTACHPTR **) menu->data)[num], - option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); + ((ATTACHPTR **) menu->data)[num], 0); } int mutt_tag_attach (MUTTMENU * menu, int n, int m) diff --git a/remailer.c b/remailer.c index f8f3882..9acc858 100644 --- a/remailer.c +++ b/remailer.c @@ -396,8 +396,7 @@ static void mix_entry (char *b, ssize_t blen, MUTTMENU * menu, int num) remailer_t **type2_list = (remailer_t **) menu->data; m_strformat(b, blen, COLS - SW, MixEntryFormat, mix_entry_fmt, - type2_list[num], - option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); + type2_list[num], 0); } static int mix_chain_add (mixchain_t * chain, const char *s,