--- mutt-1.3.23-orig/mutt_menu.h Sun Oct 28 19:35:26 2001 +++ mutt-1.3.23/mutt_menu.h Tue Oct 30 16:45:06 2001 @@ -45,6 +45,7 @@ int menu; /* menu definition for keymap entries. */ int offset; /* which screen row to start the index */ int pagelen; /* number of entries per screen */ + int columns; /* number of columns in menu */ int tagprefix; /* Setting dialog != NULL overrides normal menu behaviour. --- mutt-1.3.23-orig/init.h Sun Oct 28 19:35:26 2001 +++ mutt-1.3.23/init.h Tue Oct 30 22:49:46 2001 @@ -499,6 +499,12 @@ ** you use `+' or `=' for any other variables since expansion takes place ** during the `set' command. */ + { "folder_columns", DT_NUM, R_NONE, UL &FolderColumns, UL 1 }, + /* + ** .pp + ** Specifies the number of folder columns in folder browser. + ** + */ { "folder_format", DT_STR, R_INDEX, UL &FolderFormat, UL "%2C %t %N %F %2l %-8.8u %-8.8g %8s %d %f" }, /* ** .pp --- mutt-1.3.23-orig/globals.h Sun Oct 28 19:35:26 2001 +++ mutt-1.3.23/globals.h Tue Oct 30 22:44:42 2001 @@ -138,6 +138,7 @@ WHERE unsigned short Counter INITVAL (0); WHERE short ConnectTimeout; +WHERE short FolderColumns; WHERE short HistSize; WHERE short PagerContext; WHERE short PagerIndexLines; --- mutt-1.3.23-orig/browser.c Sun Oct 28 19:35:26 2001 +++ mutt-1.3.23/browser.c Tue Oct 30 22:44:18 2001 @@ -492,12 +492,13 @@ } static void init_menu (struct browser_state *state, MUTTMENU *menu, char *title, - size_t titlelen, int buffy) + size_t titlelen, int buffy, int columns) { char path[_POSIX_PATH_MAX]; menu->max = state->entrylen; - + menu->columns = columns; + if(menu->current >= menu->max) menu->current = menu->max - 1; if (menu->current < 0) @@ -660,7 +661,7 @@ menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_FOLDER, FolderHelp); - init_menu (&state, menu, title, sizeof (title), buffy); + init_menu (&state, menu, title, sizeof (title), buffy, FolderColumns); FOREVER { @@ -791,7 +792,7 @@ } menu->current = 0; menu->top = 0; - init_menu (&state, menu, title, sizeof (title), buffy); + init_menu (&state, menu, title, sizeof (title), buffy, 1); break; } } @@ -890,7 +891,7 @@ menu->data = state.entry; menu->current = 0; menu->top = 0; - init_menu (&state, menu, title, sizeof (title), buffy); + init_menu (&state, menu, title, sizeof (title), buffy, 1); MAYBE_REDRAW (menu->redraw); } /* else leave error on screen */ @@ -949,7 +950,7 @@ sizeof (struct folder_file) * (state.entrylen - (nentry+1))); state.entrylen--; mutt_message _("Mailbox deleted."); - init_menu (&state, menu, title, sizeof (title), buffy); + init_menu (&state, menu, title, sizeof (title), buffy, 1); MAYBE_REDRAW (menu->redraw); } } @@ -990,7 +991,7 @@ menu->data = state.entry; menu->current = 0; menu->top = 0; - init_menu (&state, menu, title, sizeof (title), buffy); + init_menu (&state, menu, title, sizeof (title), buffy, 1); } else #endif @@ -1021,7 +1022,7 @@ } menu->current = 0; menu->top = 0; - init_menu (&state, menu, title, sizeof (title), buffy); + init_menu (&state, menu, title, sizeof (title), buffy, 1); } else mutt_error (_("%s is not a directory."), buf); @@ -1078,12 +1079,12 @@ imap_browse (LastDir, &state); browser_sort (&state); menu->data = state.entry; - init_menu (&state, menu, title, sizeof (title), buffy); + init_menu (&state, menu, title, sizeof (title), buffy, 1); } else #endif if (examine_directory (menu, &state, LastDir, NULL) == 0) - init_menu (&state, menu, title, sizeof (title), buffy); + init_menu (&state, menu, title, sizeof (title), buffy, 1); else { mutt_error _("Error scanning directory."); @@ -1168,7 +1169,7 @@ #endif else if (examine_directory (menu, &state, LastDir, prefix) == -1) goto bail; - init_menu (&state, menu, title, sizeof (title), buffy); + init_menu (&state, menu, title, sizeof (title), buffy, 1); break; case OP_BUFFY_LIST: --- mutt-1.3.23-orig/menu.c Sun Oct 28 19:35:26 2001 +++ mutt-1.3.23/menu.c Wed Oct 31 09:30:28 2001 @@ -126,14 +126,14 @@ menu->make_entry (s, l, menu, i); } -void menu_pad_string (char *s, size_t l) +void menu_pad_string (MUTTMENU *menu, char *s, size_t l) { size_t n = mutt_strlen (s); int shift = option (OPTARROWCURSOR) ? 3 : 0; l--; /* save room for the terminal \0 */ - if (l > COLS - shift) - l = COLS - shift; + if (l > (COLS / menu->columns) - shift) + l = (COLS / menu->columns) - shift; /* Let's just pad the string anyway ... */ mutt_format_string (s, INT_MAX, l, l, 0, ' ', s, n, 1); @@ -191,69 +191,89 @@ menu->redraw &= ~REDRAW_STATUS; } -void menu_redraw_index (MUTTMENU *menu) +void menu_item_pos(MUTTMENU *menu, int item, int *row, int *col) { - char buf[STRING]; - int i; - - for (i = menu->top; i < menu->top + menu->pagelen; i++) - { - if (i < menu->max) - { - menu_make_entry (buf, sizeof (buf), menu, i); - menu_pad_string (buf, sizeof (buf)); + *row = (item - menu->top) % menu->pagelen; + *col = (item - menu->top) / menu->pagelen; +} - if (option (OPTARROWCURSOR)) - { - attrset (menu->color (i)); - CLEARLINE (i - menu->top + menu->offset); +void menu_redraw_index (MUTTMENU *menu) +{ + char buf[STRING]; + int i; + int row, col; - if (i == menu->current) + for (i = menu->top; i < menu->top + (menu->pagelen * menu->columns); i++) { - SETCOLOR (MT_COLOR_INDICATOR); - addstr ("->"); - attrset (menu->color (i)); - addch (' '); + menu_item_pos(menu, i, &row, &col); + if (i < menu->max) + { + menu_make_entry (buf, sizeof (buf), menu, i); + menu_pad_string (menu, buf, sizeof (buf)); + + if (option (OPTARROWCURSOR)) + { + attrset (menu->color (i)); + + move(menu->offset + row, col * (COLS / menu->columns)); + + if (i == menu->current) + { + SETCOLOR (MT_COLOR_INDICATOR); + addstr ("->"); + attrset (menu->color (i)); + addch (' '); + } + else + move(row + menu->offset, col * COLS / menu->columns + 3); + + print_enriched_string (menu->color(i), (unsigned char *) buf, + 1); + SETCOLOR (MT_COLOR_NORMAL); + } + else + { /* !option(OPTARROWCURSOR) */ + if (i == menu->current) + { + SETCOLOR (MT_COLOR_INDICATOR); + BKGDSET (MT_COLOR_INDICATOR); + } + else + attrset (menu->color (i)); + + move(row + menu->offset, col * (COLS / menu->columns)); + + print_enriched_string (menu->color(i), (unsigned char *) buf, + i != menu->current); + + SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); + } + } + else + { + if (col == 0) + { + move(row + menu->offset, col); clrtoeol(); + } + } } - else - move (i - menu->top + menu->offset, 3); - - print_enriched_string (menu->color(i), (unsigned char *) buf, 1); - SETCOLOR (MT_COLOR_NORMAL); - } - else - { - if (i == menu->current) - { - SETCOLOR (MT_COLOR_INDICATOR); - BKGDSET (MT_COLOR_INDICATOR); - } - else - attrset (menu->color (i)); - - CLEARLINE (i - menu->top + menu->offset); - print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current); - SETCOLOR (MT_COLOR_NORMAL); - BKGDSET (MT_COLOR_NORMAL); - } - } - else - CLEARLINE (i - menu->top + menu->offset); - } - menu->redraw = 0; + menu->redraw = 0; } void menu_redraw_motion (MUTTMENU *menu) { - char buf[STRING]; - + char buf[STRING]; + int row, col; + if (menu->dialog) { menu->redraw &= ~REDRAW_MOTION; return; } - - move (menu->oldcurrent + menu->offset - menu->top, 0); + + menu_item_pos(menu, menu->oldcurrent, &row, &col); + move(row + menu->offset, col * (COLS / menu->columns)); SETCOLOR (MT_COLOR_NORMAL); BKGDSET (MT_COLOR_NORMAL); @@ -265,16 +285,18 @@ if (menu->redraw & REDRAW_MOTION_RESYNCH) { - clrtoeol (); + move(row + menu->offset, col * (COLS / menu->columns)); menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); - menu_pad_string (buf, sizeof (buf)); - move (menu->oldcurrent + menu->offset - menu->top, 3); + menu_pad_string (menu, buf, sizeof (buf)); + move(row + menu->offset, col * COLS / menu->columns + 3); print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1); SETCOLOR (MT_COLOR_NORMAL); } /* now draw it in the new location */ - move (menu->current + menu->offset - menu->top, 0); + + menu_item_pos(menu, menu->current, &row, &col); + move(row + menu->offset, col * COLS / menu->columns); SETCOLOR (MT_COLOR_INDICATOR); addstr ("->"); SETCOLOR (MT_COLOR_NORMAL); @@ -283,17 +305,19 @@ { /* erase the current indicator */ attrset (menu->color (menu->oldcurrent)); - clrtoeol (); + move(row + menu->offset, col * (COLS / menu->columns)); menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); - menu_pad_string (buf, sizeof (buf)); + menu_pad_string (menu, buf, sizeof (buf)); print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1); + + menu_item_pos(menu, menu->current, &row, &col); /* now draw the new one to reflect the change */ menu_make_entry (buf, sizeof (buf), menu, menu->current); - menu_pad_string (buf, sizeof (buf)); + menu_pad_string (menu, buf, sizeof (buf)); SETCOLOR (MT_COLOR_INDICATOR); BKGDSET (MT_COLOR_INDICATOR); - CLEARLINE (menu->current - menu->top + menu->offset); + move(row + menu->offset, col * (COLS / menu->columns)); print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0); SETCOLOR (MT_COLOR_NORMAL); BKGDSET (MT_COLOR_NORMAL); @@ -304,21 +328,22 @@ void menu_redraw_current (MUTTMENU *menu) { char buf[STRING]; + int row, col; - move (menu->current + menu->offset - menu->top, 0); menu_make_entry (buf, sizeof (buf), menu, menu->current); - menu_pad_string (buf, sizeof (buf)); + menu_pad_string (menu, buf, sizeof (buf)); + menu_item_pos(menu, menu->current, &row, &col); if (option (OPTARROWCURSOR)) { int attr = menu->color (menu->current); attrset (attr); - clrtoeol (); + move(row + menu->offset, col * (COLS / menu->columns)); SETCOLOR (MT_COLOR_INDICATOR); addstr ("->"); attrset (attr); addch (' '); - menu_pad_string (buf, sizeof (buf)); + menu_pad_string (menu, buf, sizeof (buf)); print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 1); SETCOLOR (MT_COLOR_NORMAL); } @@ -326,7 +351,7 @@ { SETCOLOR (MT_COLOR_INDICATOR); BKGDSET (MT_COLOR_INDICATOR); - clrtoeol (); + move(row + menu->offset, col * (COLS / menu->columns)); print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0); SETCOLOR (MT_COLOR_NORMAL); BKGDSET (MT_COLOR_NORMAL); @@ -355,18 +380,18 @@ void menu_check_recenter (MUTTMENU *menu) { - if (menu->max <= menu->pagelen && menu->top != 0) + if (menu->max <= menu->pagelen * menu->columns && menu->top != 0) { menu->top = 0; set_option (OPTNEEDREDRAW); menu->redraw |= REDRAW_INDEX; } - else if (menu->current >= menu->top + menu->pagelen) + else if (menu->current >= menu->top + menu->pagelen * menu->columns) { if (option (OPTMENUSCROLL) || (menu->pagelen <= 0)) - menu->top = menu->current - menu->pagelen + 1; + menu->top = menu->current - menu->pagelen * menu->columns + 1; else - menu->top += menu->pagelen * ((menu->current - menu->top) / menu->pagelen); + menu->top += menu->pagelen * menu->columns * ((menu->current - menu->top) / (menu->pagelen * menu->columns)); menu->redraw |= REDRAW_INDEX; } else if (menu->current < menu->top) @@ -375,7 +400,7 @@ menu->top = menu->current; else { - menu->top -= menu->pagelen * ((menu->top + menu->pagelen - 1 - menu->current) / menu->pagelen); + menu->top -= menu->pagelen * menu->columns * ((menu->top + menu->pagelen - 1 - menu->current) / menu->pagelen); if (menu->top < 0) menu->top = 0; } @@ -666,6 +691,7 @@ p->pagelen = PAGELEN; p->color = default_color; p->search = menu_search_generic; + p->columns = 1; return (p); }