X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=menu.c;h=25d7468de3b390960cd0b1db4e0fbb5068570758;hp=0a35299a9c23957885a95d004e780d66eb661187;hb=b08dddc66a9054c0740878e53dd76c770e761553;hpb=df70e07e24add1869bcc9b7af2277d9d0c09a281 diff --git a/menu.c b/menu.c index 0a35299..25d7468 100644 --- a/menu.c +++ b/menu.c @@ -1,19 +1,10 @@ /* + * Copyright notice from original mutt: * Copyright (C) 1996-2000 Michael R. Elkins * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * This file is part of mutt-ng, see http://www.muttng.org/. + * It's licensed under the GNU General Public License, + * please see the file GPL in the top level source directory. */ #if HAVE_CONFIG_H @@ -30,6 +21,10 @@ #include "imap.h" #endif +#include "lib/mem.h" +#include "lib/intl.h" +#include "lib/str.h" + #include #include @@ -41,7 +36,7 @@ static void print_enriched_string (int attr, unsigned char *s, int do_color) { wchar_t wc; size_t k; - size_t n = mutt_strlen ((char *) s); + size_t n = safe_strlen ((char *) s); mbstate_t mbstate; memset (&mbstate, 0, sizeof (mbstate)); @@ -160,7 +155,7 @@ void menu_pad_string (char *s, size_t n) cols = COLS - shift - SidebarWidth; else cols = COLS - shift; - mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, strlen (s), 1); + mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, safe_strlen (s), 1); tmpbuf[n - 1] = 0; snprintf (s, n, "%s", tmpbuf); /* overkill */ FREE (&tmpbuf); @@ -208,7 +203,7 @@ void menu_redraw_index (MUTTMENU * menu) char buf[STRING]; int i; - draw_sidebar (1); + sidebar_draw (1); for (i = menu->top; i < menu->top + menu->pagelen; i++) { if (i < menu->max) { menu_make_entry (buf, sizeof (buf), menu, i); @@ -225,8 +220,11 @@ void menu_redraw_index (MUTTMENU * menu) attrset (menu->color (i)); addch (' '); } - else - move (i - menu->top + menu->offset, SidebarWidth + 3); + else { + attrset (menu->color (i)); + move (i - menu->top + menu->offset, SidebarWidth); + addstr (" "); + } print_enriched_string (menu->color (i), (unsigned char *) buf, 1); SETCOLOR (MT_COLOR_NORMAL); @@ -702,7 +700,7 @@ static int menu_search (MUTTMENU * menu, int op) _("Reverse search for: "), buf, sizeof (buf), M_CLEAR) != 0 || !buf[0]) return (-1); - mutt_str_replace (&menu->searchBuf, buf); + str_replace (&menu->searchBuf, buf); menu->searchDir = (op == OP_SEARCH) ? M_SEARCH_DOWN : M_SEARCH_UP; } else { @@ -833,13 +831,16 @@ int mutt_menuLoop (MUTTMENU * menu) menu->oldcurrent = menu->current; - - /* move the cursor out of the way */ - move (menu->current - menu->top + menu->offset, - (option (OPTARROWCURSOR) ? 2 : COLS - 1)); + if (option (OPTARROWCURSOR)) + move (menu->current - menu->top + menu->offset, 2); + else if (option (OPTBRAILLEFRIENDLY)) + move (menu->current - menu->top + menu->offset, 0); + else + move (menu->current - menu->top + menu->offset, COLS - 1); mutt_refresh (); + /* try to catch dialog keys before ops */ if (menu->dialog && menu_dialog_dokey (menu, &i) == 0) return i;