1 --- mutt-1.3.23-orig/mutt_menu.h Sun Oct 28 19:35:26 2001
2 +++ mutt-1.3.23/mutt_menu.h Tue Oct 30 16:45:06 2001
4 int menu; /* menu definition for keymap entries. */
5 int offset; /* which screen row to start the index */
6 int pagelen; /* number of entries per screen */
7 + int columns; /* number of columns in menu */
10 /* Setting dialog != NULL overrides normal menu behaviour.
11 --- mutt-1.3.23-orig/init.h Sun Oct 28 19:35:26 2001
12 +++ mutt-1.3.23/init.h Tue Oct 30 22:49:46 2001
14 ** you use `+' or `=' for any other variables since expansion takes place
15 ** during the `set' command.
17 + { "folder_columns", DT_NUM, R_NONE, UL &FolderColumns, UL 1 },
20 + ** Specifies the number of folder columns in folder browser.
23 { "folder_format", DT_STR, R_INDEX, UL &FolderFormat, UL "%2C %t %N %F %2l %-8.8u %-8.8g %8s %d %f" },
26 --- mutt-1.3.23-orig/globals.h Sun Oct 28 19:35:26 2001
27 +++ mutt-1.3.23/globals.h Tue Oct 30 22:44:42 2001
29 WHERE unsigned short Counter INITVAL (0);
31 WHERE short ConnectTimeout;
32 +WHERE short FolderColumns;
34 WHERE short PagerContext;
35 WHERE short PagerIndexLines;
36 --- mutt-1.3.23-orig/browser.c Sun Oct 28 19:35:26 2001
37 +++ mutt-1.3.23/browser.c Tue Oct 30 22:44:18 2001
41 static void init_menu (struct browser_state *state, MUTTMENU *menu, char *title,
42 - size_t titlelen, int buffy)
43 + size_t titlelen, int buffy, int columns)
45 char path[_POSIX_PATH_MAX];
47 menu->max = state->entrylen;
49 + menu->columns = columns;
51 if(menu->current >= menu->max)
52 menu->current = menu->max - 1;
53 if (menu->current < 0)
55 menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_FOLDER,
58 - init_menu (&state, menu, title, sizeof (title), buffy);
59 + init_menu (&state, menu, title, sizeof (title), buffy, FolderColumns);
67 - init_menu (&state, menu, title, sizeof (title), buffy);
68 + init_menu (&state, menu, title, sizeof (title), buffy, 1);
73 menu->data = state.entry;
76 - init_menu (&state, menu, title, sizeof (title), buffy);
77 + init_menu (&state, menu, title, sizeof (title), buffy, 1);
78 MAYBE_REDRAW (menu->redraw);
82 sizeof (struct folder_file) * (state.entrylen - (nentry+1)));
84 mutt_message _("Mailbox deleted.");
85 - init_menu (&state, menu, title, sizeof (title), buffy);
86 + init_menu (&state, menu, title, sizeof (title), buffy, 1);
87 MAYBE_REDRAW (menu->redraw);
91 menu->data = state.entry;
94 - init_menu (&state, menu, title, sizeof (title), buffy);
95 + init_menu (&state, menu, title, sizeof (title), buffy, 1);
103 - init_menu (&state, menu, title, sizeof (title), buffy);
104 + init_menu (&state, menu, title, sizeof (title), buffy, 1);
108 @@ -1010,12 +1011,12 @@
109 state.imap_browse = 1;
110 imap_browse (LastDir, &state);
111 menu->data = state.entry;
112 - init_menu (&state, menu, title, sizeof (title), buffy);
113 + init_menu (&state, menu, title, sizeof (title), buffy, 1);
117 if (examine_directory (menu, &state, LastDir, NULL) == 0)
118 - init_menu (&state, menu, title, sizeof (title), buffy);
119 + init_menu (&state, menu, title, sizeof (title), buffy, 1);
122 mutt_error _("Error scanning directory.");
123 @@ -1099,7 +1100,7 @@
125 else if (examine_directory (menu, &state, LastDir, prefix) == -1)
127 - init_menu (&state, menu, title, sizeof (title), buffy);
128 + init_menu (&state, menu, title, sizeof (title), buffy, 1);
131 case OP_BROWSER_NEW_FILE:
132 --- mutt-1.3.23-orig/menu.c Sun Oct 28 19:35:26 2001
133 +++ mutt-1.3.23/menu.c Wed Oct 31 09:30:28 2001
134 @@ -126,14 +126,14 @@
135 menu->make_entry (s, l, menu, i);
138 -void menu_pad_string (char *s, size_t l)
139 +void menu_pad_string (MUTTMENU *menu, char *s, size_t l)
141 size_t n = mutt_strlen (s);
142 int shift = option (OPTARROWCURSOR) ? 3 : 0;
144 l--; /* save room for the terminal \0 */
145 - if (l > COLS - shift)
147 + if (l > (COLS / menu->columns) - shift)
148 + l = (COLS / menu->columns) - shift;
150 /* Let's just pad the string anyway ... */
151 mutt_format_string (s, INT_MAX, l, l, 0, ' ', s, n, 1);
152 @@ -191,69 +191,89 @@
153 menu->redraw &= ~REDRAW_STATUS;
156 -void menu_redraw_index (MUTTMENU *menu)
157 +void menu_item_pos(MUTTMENU *menu, int item, int *row, int *col)
162 - for (i = menu->top; i < menu->top + menu->pagelen; i++)
166 - menu_make_entry (buf, sizeof (buf), menu, i);
167 - menu_pad_string (buf, sizeof (buf));
168 + *row = (item - menu->top) % menu->pagelen;
169 + *col = (item - menu->top) / menu->pagelen;
172 - if (option (OPTARROWCURSOR))
174 - attrset (menu->color (i));
175 - CLEARLINE (i - menu->top + menu->offset);
176 +void menu_redraw_index (MUTTMENU *menu)
182 - if (i == menu->current)
183 + for (i = menu->top; i < menu->top + (menu->pagelen * menu->columns); i++)
185 - SETCOLOR (MT_COLOR_INDICATOR);
187 - attrset (menu->color (i));
189 + menu_item_pos(menu, i, &row, &col);
192 + menu_make_entry (buf, sizeof (buf), menu, i);
193 + menu_pad_string (menu, buf, sizeof (buf));
195 + if (option (OPTARROWCURSOR))
197 + attrset (menu->color (i));
199 + move(menu->offset + row, col * (COLS / menu->columns));
201 + if (i == menu->current)
203 + SETCOLOR (MT_COLOR_INDICATOR);
205 + attrset (menu->color (i));
209 + move(row + menu->offset, col * COLS / menu->columns + 3);
211 + print_enriched_string (menu->color(i), (unsigned char *) buf,
213 + SETCOLOR (MT_COLOR_NORMAL);
216 + { /* !option(OPTARROWCURSOR) */
217 + if (i == menu->current)
219 + SETCOLOR (MT_COLOR_INDICATOR);
220 + BKGDSET (MT_COLOR_INDICATOR);
223 + attrset (menu->color (i));
225 + move(row + menu->offset, col * (COLS / menu->columns));
227 + print_enriched_string (menu->color(i), (unsigned char *) buf,
228 + i != menu->current);
230 + SETCOLOR (MT_COLOR_NORMAL);
231 + BKGDSET (MT_COLOR_NORMAL);
238 + move(row + menu->offset, col); clrtoeol();
243 - move (i - menu->top + menu->offset, 3);
245 - print_enriched_string (menu->color(i), (unsigned char *) buf, 1);
246 - SETCOLOR (MT_COLOR_NORMAL);
250 - if (i == menu->current)
252 - SETCOLOR (MT_COLOR_INDICATOR);
253 - BKGDSET (MT_COLOR_INDICATOR);
256 - attrset (menu->color (i));
258 - CLEARLINE (i - menu->top + menu->offset);
259 - print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current);
260 - SETCOLOR (MT_COLOR_NORMAL);
261 - BKGDSET (MT_COLOR_NORMAL);
265 - CLEARLINE (i - menu->top + menu->offset);
271 void menu_redraw_motion (MUTTMENU *menu)
280 menu->redraw &= ~REDRAW_MOTION;
284 - move (menu->oldcurrent + menu->offset - menu->top, 0);
286 + menu_item_pos(menu, menu->oldcurrent, &row, &col);
287 + move(row + menu->offset, col * (COLS / menu->columns));
288 SETCOLOR (MT_COLOR_NORMAL);
289 BKGDSET (MT_COLOR_NORMAL);
291 @@ -265,16 +285,18 @@
293 if (menu->redraw & REDRAW_MOTION_RESYNCH)
296 + move(row + menu->offset, col * (COLS / menu->columns));
297 menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
298 - menu_pad_string (buf, sizeof (buf));
299 - move (menu->oldcurrent + menu->offset - menu->top, 3);
300 + menu_pad_string (menu, buf, sizeof (buf));
301 + move(row + menu->offset, col * COLS / menu->columns + 3);
302 print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
303 SETCOLOR (MT_COLOR_NORMAL);
306 /* now draw it in the new location */
307 - move (menu->current + menu->offset - menu->top, 0);
309 + menu_item_pos(menu, menu->current, &row, &col);
310 + move(row + menu->offset, col * COLS / menu->columns);
311 SETCOLOR (MT_COLOR_INDICATOR);
313 SETCOLOR (MT_COLOR_NORMAL);
314 @@ -283,17 +305,19 @@
316 /* erase the current indicator */
317 attrset (menu->color (menu->oldcurrent));
319 + move(row + menu->offset, col * (COLS / menu->columns));
320 menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
321 - menu_pad_string (buf, sizeof (buf));
322 + menu_pad_string (menu, buf, sizeof (buf));
323 print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
326 + menu_item_pos(menu, menu->current, &row, &col);
327 /* now draw the new one to reflect the change */
328 menu_make_entry (buf, sizeof (buf), menu, menu->current);
329 - menu_pad_string (buf, sizeof (buf));
330 + menu_pad_string (menu, buf, sizeof (buf));
331 SETCOLOR (MT_COLOR_INDICATOR);
332 BKGDSET (MT_COLOR_INDICATOR);
333 - CLEARLINE (menu->current - menu->top + menu->offset);
334 + move(row + menu->offset, col * (COLS / menu->columns));
335 print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
336 SETCOLOR (MT_COLOR_NORMAL);
337 BKGDSET (MT_COLOR_NORMAL);
338 @@ -304,21 +328,22 @@
339 void menu_redraw_current (MUTTMENU *menu)
344 - move (menu->current + menu->offset - menu->top, 0);
345 menu_make_entry (buf, sizeof (buf), menu, menu->current);
346 - menu_pad_string (buf, sizeof (buf));
347 + menu_pad_string (menu, buf, sizeof (buf));
349 + menu_item_pos(menu, menu->current, &row, &col);
350 if (option (OPTARROWCURSOR))
352 int attr = menu->color (menu->current);
355 + move(row + menu->offset, col * (COLS / menu->columns));
356 SETCOLOR (MT_COLOR_INDICATOR);
360 - menu_pad_string (buf, sizeof (buf));
361 + menu_pad_string (menu, buf, sizeof (buf));
362 print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 1);
363 SETCOLOR (MT_COLOR_NORMAL);
367 SETCOLOR (MT_COLOR_INDICATOR);
368 BKGDSET (MT_COLOR_INDICATOR);
370 + move(row + menu->offset, col * (COLS / menu->columns));
371 print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
372 SETCOLOR (MT_COLOR_NORMAL);
373 BKGDSET (MT_COLOR_NORMAL);
374 @@ -355,18 +380,18 @@
376 void menu_check_recenter (MUTTMENU *menu)
378 - if (menu->max <= menu->pagelen && menu->top != 0)
379 + if (menu->max <= menu->pagelen * menu->columns && menu->top != 0)
382 set_option (OPTNEEDREDRAW);
383 menu->redraw |= REDRAW_INDEX;
385 - else if (menu->current >= menu->top + menu->pagelen)
386 + else if (menu->current >= menu->top + menu->pagelen * menu->columns)
388 if (option (OPTMENUSCROLL) || (menu->pagelen <= 0))
389 - menu->top = menu->current - menu->pagelen + 1;
390 + menu->top = menu->current - menu->pagelen * menu->columns + 1;
392 - menu->top += menu->pagelen * ((menu->current - menu->top) / menu->pagelen);
393 + menu->top += menu->pagelen * menu->columns * ((menu->current - menu->top) / (menu->pagelen * menu->columns));
394 menu->redraw |= REDRAW_INDEX;
396 else if (menu->current < menu->top)
398 menu->top = menu->current;
401 - menu->top -= menu->pagelen * ((menu->top + menu->pagelen - 1 - menu->current) / menu->pagelen);
402 + menu->top -= menu->pagelen * menu->columns * ((menu->top + menu->pagelen - 1 - menu->current) / menu->pagelen);
407 p->pagelen = PAGELEN;
408 p->color = default_color;
409 p->search = menu_search_generic;