]>
Commit | Line | Data |
---|---|---|
68eeb855 | 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 | |
3 | @@ -45,6 +45,7 @@ | |
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 */ | |
8 | int tagprefix; | |
9 | ||
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 | |
13 | @@ -499,6 +499,12 @@ | |
f9798556 | 14 | ** you use `+' or `=' for any other variables since expansion takes place |
15 | ** during the `set' command. | |
16 | */ | |
8d013520 | 17 | + { "folder_columns", DT_NUM, R_NONE, {.p=&FolderColumns}, {.l=1} }, |
f9798556 | 18 | + /* |
19 | + ** .pp | |
20 | + ** Specifies the number of folder columns in folder browser. | |
21 | + ** | |
22 | + */ | |
23 | { "folder_format", DT_STR, R_INDEX, UL &FolderFormat, UL "%2C %t %N %F %2l %-8.8u %-8.8g %8s %d %f" }, | |
24 | /* | |
25 | ** .pp | |
68eeb855 | 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 | |
28 | @@ -138,6 +138,7 @@ | |
f9798556 | 29 | WHERE unsigned short Counter INITVAL (0); |
30 | ||
31 | WHERE short ConnectTimeout; | |
32 | +WHERE short FolderColumns; | |
33 | WHERE short HistSize; | |
34 | WHERE short PagerContext; | |
35 | WHERE short PagerIndexLines; | |
68eeb855 | 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 | |
bebcbf73 | 38 | @@ -492,12 +492,13 @@ |
f9798556 | 39 | } |
40 | ||
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) | |
44 | { | |
45 | char path[_POSIX_PATH_MAX]; | |
46 | ||
47 | menu->max = state->entrylen; | |
68eeb855 | 48 | - |
49 | + menu->columns = columns; | |
50 | + | |
f9798556 | 51 | if(menu->current >= menu->max) |
52 | menu->current = menu->max - 1; | |
53 | if (menu->current < 0) | |
bebcbf73 | 54 | @@ -660,7 +661,7 @@ |
f9798556 | 55 | menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_FOLDER, |
56 | FolderHelp); | |
57 | ||
58 | - init_menu (&state, menu, title, sizeof (title), buffy); | |
59 | + init_menu (&state, menu, title, sizeof (title), buffy, FolderColumns); | |
60 | ||
61 | FOREVER | |
62 | { | |
bebcbf73 | 63 | @@ -791,7 +792,7 @@ |
f9798556 | 64 | } |
65 | menu->current = 0; | |
66 | menu->top = 0; | |
67 | - init_menu (&state, menu, title, sizeof (title), buffy); | |
68 | + init_menu (&state, menu, title, sizeof (title), buffy, 1); | |
69 | break; | |
70 | } | |
71 | } | |
bebcbf73 | 72 | @@ -890,7 +891,7 @@ |
f9798556 | 73 | menu->data = state.entry; |
74 | menu->current = 0; | |
75 | menu->top = 0; | |
76 | - init_menu (&state, menu, title, sizeof (title), buffy); | |
77 | + init_menu (&state, menu, title, sizeof (title), buffy, 1); | |
78 | MAYBE_REDRAW (menu->redraw); | |
79 | } | |
bebcbf73 AG |
80 | /* else leave error on screen */ |
81 | @@ -949,7 +950,7 @@ | |
f9798556 | 82 | sizeof (struct folder_file) * (state.entrylen - (nentry+1))); |
83 | state.entrylen--; | |
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); | |
88 | } | |
89 | } | |
bebcbf73 | 90 | @@ -990,7 +991,7 @@ |
f9798556 | 91 | menu->data = state.entry; |
92 | menu->current = 0; | |
93 | menu->top = 0; | |
94 | - init_menu (&state, menu, title, sizeof (title), buffy); | |
95 | + init_menu (&state, menu, title, sizeof (title), buffy, 1); | |
96 | } | |
97 | else | |
98 | #endif | |
bebcbf73 AG |
99 | @@ -1021,7 +1022,7 @@ |
100 | } | |
101 | menu->current = 0; | |
102 | menu->top = 0; | |
f9798556 | 103 | - init_menu (&state, menu, title, sizeof (title), buffy); |
104 | + init_menu (&state, menu, title, sizeof (title), buffy, 1); | |
105 | } | |
106 | else | |
bebcbf73 AG |
107 | mutt_error (_("%s is not a directory."), buf); |
108 | @@ -1078,12 +1079,12 @@ | |
f9798556 | 109 | imap_browse (LastDir, &state); |
bebcbf73 | 110 | browser_sort (&state); |
f9798556 | 111 | menu->data = state.entry; |
112 | - init_menu (&state, menu, title, sizeof (title), buffy); | |
113 | + init_menu (&state, menu, title, sizeof (title), buffy, 1); | |
114 | } | |
115 | else | |
116 | #endif | |
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); | |
120 | else | |
121 | { | |
122 | mutt_error _("Error scanning directory."); | |
bebcbf73 | 123 | @@ -1168,7 +1169,7 @@ |
f9798556 | 124 | #endif |
125 | else if (examine_directory (menu, &state, LastDir, prefix) == -1) | |
126 | goto bail; | |
127 | - init_menu (&state, menu, title, sizeof (title), buffy); | |
128 | + init_menu (&state, menu, title, sizeof (title), buffy, 1); | |
129 | break; | |
130 | ||
bebcbf73 | 131 | case OP_BUFFY_LIST: |
68eeb855 | 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 @@ | |
93e62478 | 135 | menu->make_entry (s, l, menu, i); |
136 | } | |
137 | ||
68eeb855 | 138 | -void menu_pad_string (char *s, size_t l) |
139 | +void menu_pad_string (MUTTMENU *menu, char *s, size_t l) | |
93e62478 | 140 | { |
68eeb855 | 141 | size_t n = mutt_strlen (s); |
93e62478 | 142 | int shift = option (OPTARROWCURSOR) ? 3 : 0; |
68eeb855 | 143 | |
144 | l--; /* save room for the terminal \0 */ | |
145 | - if (l > COLS - shift) | |
146 | - l = COLS - shift; | |
147 | + if (l > (COLS / menu->columns) - shift) | |
148 | + l = (COLS / menu->columns) - shift; | |
149 | ||
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 @@ | |
93e62478 | 153 | menu->redraw &= ~REDRAW_STATUS; |
154 | } | |
155 | ||
156 | -void menu_redraw_index (MUTTMENU *menu) | |
157 | +void menu_item_pos(MUTTMENU *menu, int item, int *row, int *col) | |
158 | { | |
159 | - char buf[STRING]; | |
160 | - int i; | |
161 | - | |
162 | - for (i = menu->top; i < menu->top + menu->pagelen; i++) | |
163 | - { | |
164 | - if (i < menu->max) | |
165 | - { | |
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; | |
170 | +} | |
171 | ||
172 | - if (option (OPTARROWCURSOR)) | |
173 | - { | |
174 | - attrset (menu->color (i)); | |
175 | - CLEARLINE (i - menu->top + menu->offset); | |
176 | +void menu_redraw_index (MUTTMENU *menu) | |
177 | +{ | |
178 | + char buf[STRING]; | |
179 | + int i; | |
180 | + int row, col; | |
181 | ||
182 | - if (i == menu->current) | |
183 | + for (i = menu->top; i < menu->top + (menu->pagelen * menu->columns); i++) | |
184 | { | |
185 | - SETCOLOR (MT_COLOR_INDICATOR); | |
186 | - addstr ("->"); | |
187 | - attrset (menu->color (i)); | |
188 | - addch (' '); | |
189 | + menu_item_pos(menu, i, &row, &col); | |
190 | + if (i < menu->max) | |
191 | + { | |
192 | + menu_make_entry (buf, sizeof (buf), menu, i); | |
193 | + menu_pad_string (menu, buf, sizeof (buf)); | |
68eeb855 | 194 | + |
93e62478 | 195 | + if (option (OPTARROWCURSOR)) |
196 | + { | |
197 | + attrset (menu->color (i)); | |
198 | + | |
199 | + move(menu->offset + row, col * (COLS / menu->columns)); | |
200 | + | |
201 | + if (i == menu->current) | |
202 | + { | |
203 | + SETCOLOR (MT_COLOR_INDICATOR); | |
204 | + addstr ("->"); | |
205 | + attrset (menu->color (i)); | |
206 | + addch (' '); | |
207 | + } | |
208 | + else | |
209 | + move(row + menu->offset, col * COLS / menu->columns + 3); | |
210 | + | |
211 | + print_enriched_string (menu->color(i), (unsigned char *) buf, | |
212 | + 1); | |
213 | + SETCOLOR (MT_COLOR_NORMAL); | |
214 | + } | |
215 | + else | |
216 | + { /* !option(OPTARROWCURSOR) */ | |
217 | + if (i == menu->current) | |
218 | + { | |
219 | + SETCOLOR (MT_COLOR_INDICATOR); | |
220 | + BKGDSET (MT_COLOR_INDICATOR); | |
221 | + } | |
222 | + else | |
223 | + attrset (menu->color (i)); | |
224 | + | |
225 | + move(row + menu->offset, col * (COLS / menu->columns)); | |
226 | + | |
227 | + print_enriched_string (menu->color(i), (unsigned char *) buf, | |
228 | + i != menu->current); | |
229 | + | |
230 | + SETCOLOR (MT_COLOR_NORMAL); | |
231 | + BKGDSET (MT_COLOR_NORMAL); | |
232 | + } | |
233 | + } | |
234 | + else | |
235 | + { | |
236 | + if (col == 0) | |
237 | + { | |
238 | + move(row + menu->offset, col); clrtoeol(); | |
239 | + } | |
240 | + } | |
241 | } | |
68eeb855 | 242 | - else |
243 | - move (i - menu->top + menu->offset, 3); | |
244 | - | |
245 | - print_enriched_string (menu->color(i), (unsigned char *) buf, 1); | |
246 | - SETCOLOR (MT_COLOR_NORMAL); | |
247 | - } | |
248 | - else | |
249 | - { | |
250 | - if (i == menu->current) | |
251 | - { | |
252 | - SETCOLOR (MT_COLOR_INDICATOR); | |
253 | - BKGDSET (MT_COLOR_INDICATOR); | |
254 | - } | |
93e62478 | 255 | - else |
256 | - attrset (menu->color (i)); | |
257 | - | |
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); | |
262 | - } | |
263 | - } | |
264 | - else | |
265 | - CLEARLINE (i - menu->top + menu->offset); | |
266 | - } | |
267 | - menu->redraw = 0; | |
268 | + menu->redraw = 0; | |
269 | } | |
270 | ||
271 | void menu_redraw_motion (MUTTMENU *menu) | |
272 | { | |
273 | - char buf[STRING]; | |
274 | - | |
275 | + char buf[STRING]; | |
276 | + int row, col; | |
277 | + | |
278 | if (menu->dialog) | |
279 | { | |
280 | menu->redraw &= ~REDRAW_MOTION; | |
281 | return; | |
282 | } | |
283 | - | |
284 | - move (menu->oldcurrent + menu->offset - menu->top, 0); | |
285 | + | |
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); | |
290 | ||
68eeb855 | 291 | @@ -265,16 +285,18 @@ |
93e62478 | 292 | |
293 | if (menu->redraw & REDRAW_MOTION_RESYNCH) | |
294 | { | |
295 | - clrtoeol (); | |
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); | |
304 | } | |
305 | ||
306 | /* now draw it in the new location */ | |
307 | - move (menu->current + menu->offset - menu->top, 0); | |
308 | + | |
309 | + menu_item_pos(menu, menu->current, &row, &col); | |
310 | + move(row + menu->offset, col * COLS / menu->columns); | |
311 | SETCOLOR (MT_COLOR_INDICATOR); | |
312 | addstr ("->"); | |
313 | SETCOLOR (MT_COLOR_NORMAL); | |
68eeb855 | 314 | @@ -283,17 +305,19 @@ |
93e62478 | 315 | { |
316 | /* erase the current indicator */ | |
317 | attrset (menu->color (menu->oldcurrent)); | |
318 | - clrtoeol (); | |
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); | |
324 | ||
325 | + | |
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); | |
68eeb855 | 338 | @@ -304,21 +328,22 @@ |
93e62478 | 339 | void menu_redraw_current (MUTTMENU *menu) |
340 | { | |
341 | char buf[STRING]; | |
342 | + int row, col; | |
343 | ||
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)); | |
348 | ||
349 | + menu_item_pos(menu, menu->current, &row, &col); | |
350 | if (option (OPTARROWCURSOR)) | |
351 | { | |
352 | int attr = menu->color (menu->current); | |
353 | attrset (attr); | |
354 | - clrtoeol (); | |
355 | + move(row + menu->offset, col * (COLS / menu->columns)); | |
356 | SETCOLOR (MT_COLOR_INDICATOR); | |
357 | addstr ("->"); | |
358 | attrset (attr); | |
359 | addch (' '); | |
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); | |
364 | } | |
68eeb855 | 365 | @@ -326,7 +351,7 @@ |
93e62478 | 366 | { |
367 | SETCOLOR (MT_COLOR_INDICATOR); | |
368 | BKGDSET (MT_COLOR_INDICATOR); | |
369 | - clrtoeol (); | |
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); | |
68eeb855 | 374 | @@ -355,18 +380,18 @@ |
93e62478 | 375 | |
376 | void menu_check_recenter (MUTTMENU *menu) | |
377 | { | |
378 | - if (menu->max <= menu->pagelen && menu->top != 0) | |
379 | + if (menu->max <= menu->pagelen * menu->columns && menu->top != 0) | |
380 | { | |
381 | menu->top = 0; | |
382 | set_option (OPTNEEDREDRAW); | |
383 | menu->redraw |= REDRAW_INDEX; | |
384 | } | |
385 | - else if (menu->current >= menu->top + menu->pagelen) | |
386 | + else if (menu->current >= menu->top + menu->pagelen * menu->columns) | |
387 | { | |
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; | |
391 | else | |
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; | |
395 | } | |
396 | else if (menu->current < menu->top) | |
68eeb855 | 397 | @@ -375,7 +400,7 @@ |
93e62478 | 398 | menu->top = menu->current; |
399 | else | |
400 | { | |
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); | |
403 | if (menu->top < 0) | |
404 | menu->top = 0; | |
405 | } | |
68eeb855 | 406 | @@ -666,6 +691,7 @@ |
93e62478 | 407 | p->pagelen = PAGELEN; |
408 | p->color = default_color; | |
409 | p->search = menu_search_generic; | |
410 | + p->columns = 1; | |
411 | return (p); | |
412 | } | |
413 |