]> git.pld-linux.org Git - packages/mutt.git/blob - mutt-folder_columns.patch
- do not apply mutt-folder_column.patch by default. It looks like this patch
[packages/mutt.git] / mutt-folder_columns.patch
1 --- mutt-1.4-orig/init.h        2002-04-25 15:26:37.000000000 +0200
2 +++ mutt-1.4/init.h     2003-01-26 19:33:40.000000000 +0100
3 @@ -519,6 +519,12 @@
4    ** you use `+' or `=' for any other variables since expansion takes place
5    ** during the `set' command.
6    */
7 +  { "folder_columns",   DT_NUM, R_NONE, UL &FolderColumns, UL 1 },
8 +  /*
9 +  ** .pp
10 +  ** Specifies the number of folder columns in folder browser.
11 +  **
12 +  */
13    { "folder_format",   DT_STR,  R_INDEX, UL &FolderFormat, UL "%2C %t %N %F %2l %-8.8u %-8.8g %8s %d %f" },
14    /*
15    ** .pp
16 --- mutt-1.4-orig/globals.h     2002-01-03 21:57:19.000000000 +0100
17 +++ mutt-1.4/globals.h  2003-01-26 19:34:05.000000000 +0100
18 @@ -143,6 +143,7 @@
19  WHERE unsigned short Counter INITVAL (0);
20  
21  WHERE short ConnectTimeout;
22 +WHERE short FolderColumns;
23  WHERE short HistSize;
24  WHERE short PagerContext;
25  WHERE short PagerIndexLines;
26 --- mutt-1.4-orig/mutt_menu.h   2001-09-11 13:20:34.000000000 +0200
27 +++ mutt-1.4/mutt_menu.h        2003-01-26 19:33:01.000000000 +0100
28 @@ -45,6 +45,7 @@
29    int menu;    /* menu definition for keymap entries. */
30    int offset;  /* which screen row to start the index */
31    int pagelen; /* number of entries per screen */
32 +       int columns;  /* number of columns in menu */
33    int tagprefix;
34  
35    /* Setting dialog != NULL overrides normal menu behaviour. 
36 --- mutt-1.4-orig/browser.c     2002-03-19 10:54:00.000000000 +0100
37 +++ mutt-1.4/browser.c  2003-01-26 19:35:34.000000000 +0100
38 @@ -476,12 +476,14 @@
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;
48  
49 +  menu->columns = columns;
50 +       
51    if(menu->current >= menu->max)
52      menu->current = menu->max - 1;
53    if (menu->current < 0)
54 @@ -636,7 +638,7 @@
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    {
63 @@ -767,7 +769,7 @@
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         }
72 @@ -865,7 +867,7 @@
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         }
80         break;
81 @@ -895,7 +897,7 @@
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           }
90 @@ -935,7 +937,7 @@
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
99 @@ -949,7 +951,7 @@
100               {
101                 menu->current = 0; 
102                 menu->top = 0; 
103 -               init_menu (&state, menu, title, sizeof (title), buffy);
104 +               init_menu (&state, menu, title, sizeof (title), buffy, 1);
105               }
106               else
107               {
108 @@ -1012,12 +1014,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);
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.");
123 @@ -1101,7 +1103,7 @@
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  
131        case OP_BROWSER_NEW_FILE:
132 --- mutt-1.4.2.1/menu.c.orig    2004-02-14 17:54:37.148495120 +0100
133 +++ mutt-1.4.2.1/menu.c 2004-02-14 17:55:46.357973680 +0100
134 @@ -148,7 +148,7 @@
135      menu->make_entry (s, l, menu, i);
136  }
137  
138 -void menu_pad_string (char *s, size_t n)
139 +void menu_pad_string (MUTTMENU *menu, char *s, size_t n)
140  {
141    int shift = option (OPTARROWCURSOR) ? 3 : 0;
142    int cols = COLS - shift;
143 @@ -196,69 +196,89 @@
144    menu->redraw &= ~REDRAW_STATUS;
145  }
146  
147 -void menu_redraw_index (MUTTMENU *menu)
148 +void menu_item_pos(MUTTMENU *menu, int item, int *row, int *col)
149  {
150 -  char buf[STRING];
151 -  int i;
152 -
153 -  for (i = menu->top; i < menu->top + menu->pagelen; i++)
154 -  {
155 -    if (i < menu->max)
156 -    {
157 -      menu_make_entry (buf, sizeof (buf), menu, i);
158 -      menu_pad_string (buf, sizeof (buf));
159 +       *row = (item - menu->top) % menu->pagelen;      
160 +       *col = (item - menu->top) / menu->pagelen;
161 +}
162  
163 -      if (option (OPTARROWCURSOR))
164 -      {
165 -        attrset (menu->color (i));
166 -       CLEARLINE (i - menu->top + menu->offset);
167 +void menu_redraw_index (MUTTMENU *menu)
168 +{
169 +       char buf[STRING];
170 +       int i;
171 +       int row, col;
172  
173 -       if (i == menu->current)
174 +       for (i = menu->top; i < menu->top + (menu->pagelen * menu->columns); i++)
175         {
176 -         SETCOLOR (MT_COLOR_INDICATOR);
177 -         addstr ("->");
178 -          attrset (menu->color (i));
179 -         addch (' ');
180 -       }
181 -       else
182 -         move (i - menu->top + menu->offset, 3);
183 +               menu_item_pos(menu, i, &row, &col);
184 +               if (i < menu->max)
185 +           {
186 +                       menu_make_entry (buf, sizeof (buf), menu, i);
187 +                       menu_pad_string (menu, buf, sizeof (buf));
188  
189 -        print_enriched_string (menu->color(i), (unsigned char *) buf, 1);
190 -        SETCOLOR (MT_COLOR_NORMAL);          
191 -      }
192 -      else
193 -      {
194 -       if (i == menu->current)
195 -       {
196 -         SETCOLOR (MT_COLOR_INDICATOR);
197 -         BKGDSET (MT_COLOR_INDICATOR);
198 +                       if (option (OPTARROWCURSOR))
199 +                       {
200 +                               attrset (menu->color (i));
201 +
202 +                               move(menu->offset + row, col * (COLS / menu->columns));
203 +                               
204 +                               if (i == menu->current)
205 +                               {
206 +                                       SETCOLOR (MT_COLOR_INDICATOR);
207 +                                       addstr ("->");
208 +                                       attrset (menu->color (i));
209 +                                       addch (' ');
210 +                               }
211 +                               else
212 +                                       move(row + menu->offset, col * COLS / menu->columns + 3);
213 +
214 +                               print_enriched_string (menu->color(i), (unsigned char *) buf,
215 +                                       1);
216 +                               SETCOLOR (MT_COLOR_NORMAL);          
217 +                       }          
218 +                       else
219 +                       { /* !option(OPTARROWCURSOR) */
220 +                               if (i == menu->current)
221 +                               {
222 +                                       SETCOLOR (MT_COLOR_INDICATOR);
223 +                                       BKGDSET (MT_COLOR_INDICATOR);
224 +                               }
225 +                               else
226 +                                       attrset (menu->color (i));
227 +
228 +                               move(row + menu->offset, col * (COLS / menu->columns));
229 +
230 +                               print_enriched_string (menu->color(i), (unsigned char *) buf,
231 +                                       i != menu->current);
232 +                               
233 +                               SETCOLOR (MT_COLOR_NORMAL);
234 +                               BKGDSET (MT_COLOR_NORMAL);
235 +                       }
236 +               }
237 +               else
238 +               {
239 +                       if (col == 0)
240 +                       {
241 +                               move(row + menu->offset, col); clrtoeol();
242 +                       }
243 +               }
244         }
245 -        else
246 -          attrset (menu->color (i));
247 -            
248 -       CLEARLINE (i - menu->top + menu->offset);
249 -       print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current);
250 -        SETCOLOR (MT_COLOR_NORMAL);
251 -        BKGDSET (MT_COLOR_NORMAL);
252 -      }
253 -    }
254 -    else
255 -      CLEARLINE (i - menu->top + menu->offset);
256 -  }
257 -  menu->redraw = 0;
258 +       menu->redraw = 0;
259  }
260  
261  void menu_redraw_motion (MUTTMENU *menu)
262  {
263 -  char buf[STRING];
264 -
265 +       char buf[STRING];
266 +       int row, col;
267
268    if (menu->dialog) 
269    {
270      menu->redraw &= ~REDRAW_MOTION;
271      return;
272    }
273 -  
274 -  move (menu->oldcurrent + menu->offset - menu->top, 0);
275 +
276 +       menu_item_pos(menu, menu->oldcurrent, &row, &col);
277 +       move(row + menu->offset, col * (COLS / menu->columns));
278    SETCOLOR (MT_COLOR_NORMAL);
279    BKGDSET (MT_COLOR_NORMAL);
280  
281 @@ -270,16 +290,18 @@
282  
283      if (menu->redraw & REDRAW_MOTION_RESYNCH)
284      {
285 -      clrtoeol ();
286 +               move(row + menu->offset, col * (COLS / menu->columns));
287        menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
288 -      menu_pad_string (buf, sizeof (buf));
289 -      move (menu->oldcurrent + menu->offset - menu->top, 3);
290 +      menu_pad_string (menu, buf, sizeof (buf));
291 +         move(row + menu->offset, col * COLS / menu->columns + 3);
292        print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
293        SETCOLOR (MT_COLOR_NORMAL);
294      }
295  
296      /* now draw it in the new location */
297 -    move (menu->current + menu->offset - menu->top, 0);
298 +
299 +       menu_item_pos(menu, menu->current, &row, &col); 
300 +       move(row + menu->offset, col * COLS / menu->columns);
301      SETCOLOR (MT_COLOR_INDICATOR);
302      addstr ("->");
303      SETCOLOR (MT_COLOR_NORMAL);
304 @@ -288,17 +310,19 @@
305    {
306      /* erase the current indicator */
307      attrset (menu->color (menu->oldcurrent));
308 -    clrtoeol ();
309 +       move(row + menu->offset, col * (COLS / menu->columns));
310      menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
311 -    menu_pad_string (buf, sizeof (buf));
312 +    menu_pad_string (menu, buf, sizeof (buf));
313      print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
314  
315 +
316 +       menu_item_pos(menu, menu->current, &row, &col);
317      /* now draw the new one to reflect the change */
318      menu_make_entry (buf, sizeof (buf), menu, menu->current);
319 -    menu_pad_string (buf, sizeof (buf));
320 +    menu_pad_string (menu, buf, sizeof (buf));
321      SETCOLOR (MT_COLOR_INDICATOR);
322      BKGDSET (MT_COLOR_INDICATOR);
323 -    CLEARLINE (menu->current - menu->top + menu->offset);
324 +    move(row + menu->offset, col * (COLS / menu->columns));    
325      print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
326      SETCOLOR (MT_COLOR_NORMAL);
327      BKGDSET (MT_COLOR_NORMAL);
328 @@ -309,21 +333,22 @@
329  void menu_redraw_current (MUTTMENU *menu)
330  {
331    char buf[STRING];
332 +  int row, col;
333    
334 -  move (menu->current + menu->offset - menu->top, 0);
335    menu_make_entry (buf, sizeof (buf), menu, menu->current);
336 -  menu_pad_string (buf, sizeof (buf));
337 +  menu_pad_string (menu, buf, sizeof (buf));
338  
339 +       menu_item_pos(menu, menu->current, &row, &col);
340    if (option (OPTARROWCURSOR))
341    {
342      int attr = menu->color (menu->current);
343      attrset (attr);
344 -    clrtoeol ();
345 +       move(row + menu->offset, col * (COLS / menu->columns));
346      SETCOLOR (MT_COLOR_INDICATOR);
347      addstr ("->");
348      attrset (attr);
349      addch (' ');
350 -    menu_pad_string (buf, sizeof (buf));
351 +    menu_pad_string (menu, buf, sizeof (buf));
352      print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 1);
353      SETCOLOR (MT_COLOR_NORMAL);
354    }
355 @@ -331,7 +356,7 @@
356    {
357      SETCOLOR (MT_COLOR_INDICATOR);
358      BKGDSET (MT_COLOR_INDICATOR);
359 -    clrtoeol ();
360 +       move(row + menu->offset, col * (COLS / menu->columns));
361      print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
362      SETCOLOR (MT_COLOR_NORMAL);
363      BKGDSET (MT_COLOR_NORMAL);
364 @@ -360,18 +385,18 @@
365  
366  void menu_check_recenter (MUTTMENU *menu)
367  {
368 -  if (menu->max <= menu->pagelen && menu->top != 0)
369 +  if (menu->max <= menu->pagelen * menu->columns && menu->top != 0)
370    {
371      menu->top = 0;
372      set_option (OPTNEEDREDRAW);
373      menu->redraw |= REDRAW_INDEX;
374    }
375 -  else if (menu->current >= menu->top + menu->pagelen)
376 +  else if (menu->current >= menu->top + menu->pagelen * menu->columns)
377    {
378      if (option (OPTMENUSCROLL) || (menu->pagelen <= 0))
379 -      menu->top = menu->current - menu->pagelen + 1;
380 +      menu->top = menu->current - menu->pagelen * menu->columns + 1;
381      else
382 -      menu->top += menu->pagelen * ((menu->current - menu->top) / menu->pagelen);
383 +      menu->top += menu->pagelen * menu->columns * ((menu->current - menu->top) / (menu->pagelen * menu->columns));
384      menu->redraw |= REDRAW_INDEX;
385    }
386    else if (menu->current < menu->top)
387 @@ -380,7 +405,7 @@
388        menu->top = menu->current;
389      else
390      {
391 -      menu->top -= menu->pagelen * ((menu->top + menu->pagelen - 1 - menu->current) / menu->pagelen);
392 +      menu->top -= menu->pagelen * menu->columns * ((menu->top + menu->pagelen - 1 - menu->current) / menu->pagelen);
393        if (menu->top < 0)
394         menu->top = 0;
395      }
396 @@ -671,6 +696,7 @@
397    p->pagelen = PAGELEN;
398    p->color = default_color;
399    p->search = menu_search_generic;
400 +  p->columns = 1;
401    return (p);
402  }
403  
This page took 0.073392 seconds and 3 git commands to generate.