]> git.pld-linux.org Git - packages/mutt.git/blame - mutt-folder_columns.patch
- rel 0.2, NFY
[packages/mutt.git] / mutt-folder_columns.patch
CommitLineData
f00d14df 1--- mutt-1.4.2.1/menu.c.orig 2004-02-14 11:15:52.874537592 +0100
2+++ mutt-1.4.2.1/menu.c 2004-02-14 11:17:58.135495032 +0100
3@@ -148,7 +148,7 @@
93e62478 4 menu->make_entry (s, l, menu, i);
5 }
6
f00d14df 7-void menu_pad_string (char *s, size_t n)
93e62478 8+void menu_pad_string (MUTTMENU *menu, char *s, size_t l)
9 {
93e62478 10 int shift = option (OPTARROWCURSOR) ? 3 : 0;
f00d14df 11 int cols = COLS - shift;
12@@ -196,69 +196,89 @@
93e62478 13 menu->redraw &= ~REDRAW_STATUS;
14 }
15
16-void menu_redraw_index (MUTTMENU *menu)
17+void menu_item_pos(MUTTMENU *menu, int item, int *row, int *col)
18 {
19- char buf[STRING];
20- int i;
21-
22- for (i = menu->top; i < menu->top + menu->pagelen; i++)
23- {
24- if (i < menu->max)
25- {
26- menu_make_entry (buf, sizeof (buf), menu, i);
27- menu_pad_string (buf, sizeof (buf));
28+ *row = (item - menu->top) % menu->pagelen;
29+ *col = (item - menu->top) / menu->pagelen;
30+}
31
32- if (option (OPTARROWCURSOR))
33- {
34- attrset (menu->color (i));
35- CLEARLINE (i - menu->top + menu->offset);
36+void menu_redraw_index (MUTTMENU *menu)
37+{
38+ char buf[STRING];
39+ int i;
40+ int row, col;
41
42- if (i == menu->current)
43+ for (i = menu->top; i < menu->top + (menu->pagelen * menu->columns); i++)
44 {
45- SETCOLOR (MT_COLOR_INDICATOR);
46- addstr ("->");
47- attrset (menu->color (i));
48- addch (' ');
f00d14df 49- }
50- else
51- move (i - menu->top + menu->offset, 3);
93e62478 52+ menu_item_pos(menu, i, &row, &col);
53+ if (i < menu->max)
54+ {
55+ menu_make_entry (buf, sizeof (buf), menu, i);
56+ menu_pad_string (menu, buf, sizeof (buf));
f00d14df 57
58- print_enriched_string (menu->color(i), (unsigned char *) buf, 1);
59- SETCOLOR (MT_COLOR_NORMAL);
60- }
61- else
62- {
63- if (i == menu->current)
64- {
65- SETCOLOR (MT_COLOR_INDICATOR);
66- BKGDSET (MT_COLOR_INDICATOR);
93e62478 67+ if (option (OPTARROWCURSOR))
68+ {
69+ attrset (menu->color (i));
70+
71+ move(menu->offset + row, col * (COLS / menu->columns));
72+
73+ if (i == menu->current)
74+ {
75+ SETCOLOR (MT_COLOR_INDICATOR);
76+ addstr ("->");
77+ attrset (menu->color (i));
78+ addch (' ');
79+ }
80+ else
81+ move(row + menu->offset, col * COLS / menu->columns + 3);
82+
83+ print_enriched_string (menu->color(i), (unsigned char *) buf,
84+ 1);
85+ SETCOLOR (MT_COLOR_NORMAL);
86+ }
87+ else
88+ { /* !option(OPTARROWCURSOR) */
89+ if (i == menu->current)
90+ {
91+ SETCOLOR (MT_COLOR_INDICATOR);
92+ BKGDSET (MT_COLOR_INDICATOR);
93+ }
94+ else
95+ attrset (menu->color (i));
96+
97+ move(row + menu->offset, col * (COLS / menu->columns));
98+
99+ print_enriched_string (menu->color(i), (unsigned char *) buf,
100+ i != menu->current);
101+
102+ SETCOLOR (MT_COLOR_NORMAL);
103+ BKGDSET (MT_COLOR_NORMAL);
104+ }
105+ }
106+ else
107+ {
108+ if (col == 0)
109+ {
110+ move(row + menu->offset, col); clrtoeol();
111+ }
112+ }
113 }
93e62478 114- else
115- attrset (menu->color (i));
116-
117- CLEARLINE (i - menu->top + menu->offset);
118- print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current);
119- SETCOLOR (MT_COLOR_NORMAL);
120- BKGDSET (MT_COLOR_NORMAL);
121- }
122- }
123- else
124- CLEARLINE (i - menu->top + menu->offset);
125- }
126- menu->redraw = 0;
127+ menu->redraw = 0;
128 }
129
130 void menu_redraw_motion (MUTTMENU *menu)
131 {
132- char buf[STRING];
133-
134+ char buf[STRING];
135+ int row, col;
136+
137 if (menu->dialog)
138 {
139 menu->redraw &= ~REDRAW_MOTION;
140 return;
141 }
142-
143- move (menu->oldcurrent + menu->offset - menu->top, 0);
144+
145+ menu_item_pos(menu, menu->oldcurrent, &row, &col);
146+ move(row + menu->offset, col * (COLS / menu->columns));
147 SETCOLOR (MT_COLOR_NORMAL);
148 BKGDSET (MT_COLOR_NORMAL);
149
f00d14df 150@@ -270,16 +290,18 @@
93e62478 151
152 if (menu->redraw & REDRAW_MOTION_RESYNCH)
153 {
154- clrtoeol ();
155+ move(row + menu->offset, col * (COLS / menu->columns));
156 menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
157- menu_pad_string (buf, sizeof (buf));
158- move (menu->oldcurrent + menu->offset - menu->top, 3);
159+ menu_pad_string (menu, buf, sizeof (buf));
160+ move(row + menu->offset, col * COLS / menu->columns + 3);
161 print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
162 SETCOLOR (MT_COLOR_NORMAL);
163 }
164
165 /* now draw it in the new location */
166- move (menu->current + menu->offset - menu->top, 0);
167+
168+ menu_item_pos(menu, menu->current, &row, &col);
169+ move(row + menu->offset, col * COLS / menu->columns);
170 SETCOLOR (MT_COLOR_INDICATOR);
171 addstr ("->");
172 SETCOLOR (MT_COLOR_NORMAL);
f00d14df 173@@ -288,17 +310,19 @@
93e62478 174 {
175 /* erase the current indicator */
176 attrset (menu->color (menu->oldcurrent));
177- clrtoeol ();
178+ move(row + menu->offset, col * (COLS / menu->columns));
179 menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
180- menu_pad_string (buf, sizeof (buf));
181+ menu_pad_string (menu, buf, sizeof (buf));
182 print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
183
184+
185+ menu_item_pos(menu, menu->current, &row, &col);
186 /* now draw the new one to reflect the change */
187 menu_make_entry (buf, sizeof (buf), menu, menu->current);
188- menu_pad_string (buf, sizeof (buf));
189+ menu_pad_string (menu, buf, sizeof (buf));
190 SETCOLOR (MT_COLOR_INDICATOR);
191 BKGDSET (MT_COLOR_INDICATOR);
192- CLEARLINE (menu->current - menu->top + menu->offset);
193+ move(row + menu->offset, col * (COLS / menu->columns));
194 print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
195 SETCOLOR (MT_COLOR_NORMAL);
196 BKGDSET (MT_COLOR_NORMAL);
f00d14df 197@@ -309,21 +333,22 @@
93e62478 198 void menu_redraw_current (MUTTMENU *menu)
199 {
200 char buf[STRING];
201+ int row, col;
202
203- move (menu->current + menu->offset - menu->top, 0);
204 menu_make_entry (buf, sizeof (buf), menu, menu->current);
205- menu_pad_string (buf, sizeof (buf));
206+ menu_pad_string (menu, buf, sizeof (buf));
207
208+ menu_item_pos(menu, menu->current, &row, &col);
209 if (option (OPTARROWCURSOR))
210 {
211 int attr = menu->color (menu->current);
212 attrset (attr);
213- clrtoeol ();
214+ move(row + menu->offset, col * (COLS / menu->columns));
215 SETCOLOR (MT_COLOR_INDICATOR);
216 addstr ("->");
217 attrset (attr);
218 addch (' ');
219- menu_pad_string (buf, sizeof (buf));
220+ menu_pad_string (menu, buf, sizeof (buf));
221 print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 1);
222 SETCOLOR (MT_COLOR_NORMAL);
223 }
f00d14df 224@@ -331,7 +356,7 @@
93e62478 225 {
226 SETCOLOR (MT_COLOR_INDICATOR);
227 BKGDSET (MT_COLOR_INDICATOR);
228- clrtoeol ();
229+ move(row + menu->offset, col * (COLS / menu->columns));
230 print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
231 SETCOLOR (MT_COLOR_NORMAL);
232 BKGDSET (MT_COLOR_NORMAL);
f00d14df 233@@ -360,18 +385,18 @@
93e62478 234
235 void menu_check_recenter (MUTTMENU *menu)
236 {
237- if (menu->max <= menu->pagelen && menu->top != 0)
238+ if (menu->max <= menu->pagelen * menu->columns && menu->top != 0)
239 {
240 menu->top = 0;
241 set_option (OPTNEEDREDRAW);
242 menu->redraw |= REDRAW_INDEX;
243 }
244- else if (menu->current >= menu->top + menu->pagelen)
245+ else if (menu->current >= menu->top + menu->pagelen * menu->columns)
246 {
247 if (option (OPTMENUSCROLL) || (menu->pagelen <= 0))
248- menu->top = menu->current - menu->pagelen + 1;
249+ menu->top = menu->current - menu->pagelen * menu->columns + 1;
250 else
251- menu->top += menu->pagelen * ((menu->current - menu->top) / menu->pagelen);
252+ menu->top += menu->pagelen * menu->columns * ((menu->current - menu->top) / (menu->pagelen * menu->columns));
253 menu->redraw |= REDRAW_INDEX;
254 }
255 else if (menu->current < menu->top)
f00d14df 256@@ -380,7 +405,7 @@
93e62478 257 menu->top = menu->current;
258 else
259 {
260- menu->top -= menu->pagelen * ((menu->top + menu->pagelen - 1 - menu->current) / menu->pagelen);
261+ menu->top -= menu->pagelen * menu->columns * ((menu->top + menu->pagelen - 1 - menu->current) / menu->pagelen);
262 if (menu->top < 0)
263 menu->top = 0;
264 }
f00d14df 265@@ -671,6 +696,7 @@
93e62478 266 p->pagelen = PAGELEN;
267 p->color = default_color;
268 p->search = menu_search_generic;
269+ p->columns = 1;
270 return (p);
271 }
272
This page took 0.056429 seconds and 4 git commands to generate.