73482a74 |
1 | diff -ur tf-50b3/src/globals.h tfmod/src/globals.h |
2 | --- tf-50b3/src/globals.h Tue Jan 6 01:11:04 2004 |
3 | +++ tfmod/src/globals.h Mon Jan 5 23:28:48 2004 |
4 | @@ -209,6 +209,7 @@ |
5 | #define sockmload getintvar(VAR_sockmload) |
6 | #define status_fields getstdvar(VAR_stat_fields) |
7 | #define status_pad getstdvar(VAR_stat_pad) |
8 | +#define status_height getintvar(VAR_stat_height) |
9 | #define sub getintvar(VAR_sub) |
10 | #define tabsize getintvar(VAR_tabsize) |
11 | #define telopt getintvar(VAR_telopt) |
12 | diff -ur tf-50b3/src/output.c tfmod/src/output.c |
13 | --- tf-50b3/src/output.c Tue Jan 6 01:11:04 2004 |
14 | +++ tfmod/src/output.c Tue Jan 6 00:27:03 2004 |
15 | @@ -15,6 +15,8 @@ |
16 | * Handles all screen-related phenomena. |
17 | *****************************************************************/ |
18 | |
19 | +#define MAX_STATUS_HEIGHT 5 |
20 | + |
21 | #define TERM_vt100 1 |
22 | #define TERM_vt220 2 |
23 | #define TERM_ansi 3 |
24 | @@ -392,15 +394,15 @@ |
25 | lines = ((str = getvar("LINES"))) ? atoi(str) : 0; |
26 | columns = ((str = getvar("COLUMNS"))) ? atoi(str) : 0; |
27 | if (lines <= 0 || columns <= 0) get_window_size(); |
28 | - ystatus = lines - isize; |
29 | + ystatus = lines - isize - (status_height-1); |
30 | top_margin = 1; |
31 | bottom_margin = lines; |
32 | |
33 | prompt = fgprompt(); |
34 | |
35 | init_term(); |
36 | - Stringninit(status_line, columns); |
37 | - check_charattrs(status_line, columns, 0, __FILE__, __LINE__); |
38 | + Stringninit(status_line, columns*MAX_STATUS_HEIGHT); |
39 | + check_charattrs(status_line, columns*MAX_STATUS_HEIGHT, 0, __FILE__, __LINE__); |
40 | ch_hiliteattr(); |
41 | ch_alert_attr(); |
42 | redraw(); |
43 | @@ -657,7 +659,7 @@ |
44 | } else { |
45 | prompt = fgprompt(); |
46 | if (isize > lines - 3) set_var_by_id(VAR_isize, lines - 3); |
47 | - ystatus = lines - isize; |
48 | + ystatus = lines - isize - (status_height - 1); |
49 | #if 0 |
50 | outcount = ystatus - 1; |
51 | #endif |
52 | @@ -668,7 +670,7 @@ |
53 | } |
54 | update_status_line(); |
55 | ix = iendx = oy = 1; |
56 | - iy = iendy = istarty = ystatus + 1; |
57 | + iy = iendy = istarty = ystatus + status_height; |
58 | ipos(); |
59 | #endif |
60 | } |
61 | @@ -1282,8 +1284,8 @@ |
62 | } |
63 | |
64 | if (width > columns) { |
65 | - eprintf("status_fields: status width (%d) is wider than screen (%d)", |
66 | - width, columns); |
67 | +// eprintf("status_fields: status width (%d) is wider than screen (%d)", |
68 | +// width, columns); |
69 | } |
70 | |
71 | /* update new fields */ |
72 | @@ -1374,21 +1376,21 @@ |
73 | { |
74 | int column; |
75 | if (field->column >= 0) |
76 | - return (field->column > columns) ? columns : field->column; |
77 | + return (field->column > columns*status_height) ? columns*status_height : field->column; |
78 | column = field->column + |
79 | - ((status_left + status_right > columns) ? |
80 | - status_left + status_right : columns); |
81 | - return (column > columns) ? columns : column; |
82 | + ((status_left + status_right > columns*status_height) ? |
83 | + status_left + status_right : columns*status_height); |
84 | + return (column > columns*status_height) ? columns*status_height : column; |
85 | } |
86 | |
87 | static int status_width(StatusField *field, int start) |
88 | { |
89 | int width; |
90 | - if (start >= columns) return 0; |
91 | - width = (field->width == 0) ? columns - status_right - status_left : |
92 | + if (start >= columns*status_height) return 0; |
93 | + width = (field->width == 0) ? columns*status_height - status_right - status_left : |
94 | (field->width > 0) ? field->width : -field->width; |
95 | - if (width > columns - start) |
96 | - width = columns - start; |
97 | + if (width > columns*status_height - start) |
98 | + width = columns*status_height - start; |
99 | if (width < 0) |
100 | width = 0; |
101 | return width; |
102 | @@ -1548,7 +1550,7 @@ |
103 | } |
104 | if (internal >= 0 && field->internal != internal) continue; |
105 | column = status_field_column(field); |
106 | - if (column >= columns) /* doesn't fit, nor will any later fields */ |
107 | + if (column >= columns*status_height) /* doesn't fit, nor will any later fields */ |
108 | break; |
109 | count++; |
110 | width = format_status_field(field); |
111 | @@ -1589,12 +1591,12 @@ |
112 | for (node = status_field_list->head; node; node = node->next) { |
113 | field = (StatusField*)node->datum; |
114 | |
115 | - if ((column = status_field_column(field)) >= columns) |
116 | + if ((column = status_field_column(field)) >= columns*status_height) |
117 | break; |
118 | width = format_status_field(field); |
119 | } |
120 | |
121 | - for (column += width; column < columns; column++) { |
122 | + for (column += width; column < columns*status_height; column++) { |
123 | status_line->data[column] = true_status_pad; |
124 | status_line->charattrs[column] = status_attr; |
125 | } |
126 | @@ -1602,23 +1604,33 @@ |
127 | |
128 | int display_status_line(void) |
129 | { |
130 | + int i; |
131 | if (screen_mode < 1) return 0; |
132 | |
133 | if (!alert_len) { |
134 | /* no overlap with alert */ |
135 | - xy(1, ystatus); |
136 | - hwrite(status_line, 0, columns, 0); |
137 | + for (i=0;i<status_height;i++) { |
138 | + xy(1, ystatus+i); |
139 | + hwrite(status_line, (columns*i), columns, 0); |
140 | + } |
141 | } else { |
142 | /* overlap with alert (this could happen in ch_status_attr()) */ |
143 | - if (alert_pos > 0) { |
144 | - xy(1, ystatus); |
145 | - hwrite(status_line, 0, alert_pos, 0); |
146 | - } |
147 | - if (alert_pos + alert_len < columns) { |
148 | - xy(alert_pos + alert_len + 1, ystatus); |
149 | - hwrite(status_line, alert_pos + alert_len, |
150 | - columns - (alert_pos + alert_len), 0); |
151 | + for (i=0;i<status_height;i++) { |
152 | + if (!i) { |
153 | + if (alert_pos > 0) { |
154 | + xy(1, ystatus); |
155 | + hwrite(status_line, 0, alert_pos, 0); |
156 | + } |
157 | + if (alert_pos + alert_len < columns) { |
158 | + xy(alert_pos + alert_len + 1, ystatus); |
159 | + hwrite(status_line, alert_pos + alert_len, |
160 | + columns - (alert_pos + alert_len), 0); |
161 | + } |
162 | + } else { |
163 | + xy(1, ystatus+i); |
164 | + hwrite(status_line, (columns*i), columns, 0); |
165 | } |
166 | + } |
167 | } |
168 | |
169 | bufflush(); |
170 | @@ -1710,11 +1722,12 @@ |
171 | int ch_visual(void) |
172 | { |
173 | static int old_isize = 0; |
174 | + static int old_height = 0; |
175 | int need_redraw; |
176 | |
177 | - if (status_line->len < columns) |
178 | - Stringnadd(status_line, '?', columns - status_line->len); |
179 | - Stringtrunc(status_line, columns); |
180 | + if (status_line->len < columns*status_height) |
181 | + Stringnadd(status_line, '?', columns*status_height - status_line->len); |
182 | + Stringtrunc(status_line, columns*status_height); |
183 | |
184 | if (screen_mode < 0) { /* e.g., called by init_variables() */ |
185 | need_redraw = 0; |
186 | @@ -1728,6 +1741,11 @@ |
187 | #ifdef SCREEN |
188 | } else if (isize != old_isize) { /* %isize changed */ |
189 | need_redraw = 1; |
190 | + } else if (status_height != old_height) { /* %status_height changed */ |
191 | + if (status_height > MAX_STATUS_HEIGHT) { |
192 | + set_var_by_id(VAR_stat_height, MAX_STATUS_HEIGHT); |
193 | + } |
194 | + need_redraw = 1; |
195 | } else { /* SIGWINCH */ |
196 | /* Set ystatus to the top of the area fix_screen() must erase. */ |
197 | /* ystatus = 1; */ |
198 | @@ -1742,6 +1760,7 @@ |
199 | transmit_window_size(); |
200 | } |
201 | old_isize = isize; |
202 | + old_height = status_height; |
203 | return 1; |
204 | } |
205 | |
206 | @@ -1810,9 +1829,9 @@ |
207 | static void clear_input_window(void) |
208 | { |
209 | /* only called in visual mode */ |
210 | - clear_lines(ystatus + 1, lines); |
211 | + clear_lines(ystatus + status_height, lines); |
212 | ix = iendx = 1; |
213 | - iy = iendy = istarty = ystatus + 1; |
214 | + iy = iendy = istarty = ystatus + status_height; |
215 | ipos(); |
216 | } |
217 | |
218 | @@ -1830,14 +1849,14 @@ |
219 | static void scroll_input(int n) |
220 | { |
221 | if (n > isize) { |
222 | - clear_lines(ystatus + 1, lines); |
223 | - iendy = ystatus + 1; |
224 | + clear_lines(ystatus + status_height, lines); |
225 | + iendy = ystatus + status_height; |
226 | } else if (delete_line) { |
227 | - xy(1, ystatus + 1); |
228 | + xy(1, ystatus + status_height); |
229 | for (iendy = lines + 1; iendy > lines - n + 1; iendy--) |
230 | tp(delete_line); |
231 | } else if (has_scroll_region) { |
232 | - setscroll(ystatus + 1, lines); |
233 | + setscroll(ystatus + status_height, lines); |
234 | xy(1, lines); |
235 | crnl(n); /* DON'T: cy += n; */ |
236 | iendy = lines - n + 1; |
237 | @@ -1986,7 +2005,7 @@ |
238 | iendx = ix = 1; |
239 | } else if (scroll && !clearfull) { |
240 | scroll_input(1); |
241 | - if (istarty > ystatus + 1) istarty--; |
242 | + if (istarty > ystatus + status_height) istarty--; |
243 | } else { |
244 | clear_input_window(); |
245 | } |
246 | @@ -2176,7 +2195,7 @@ |
247 | ioutall(place - (ix - 1) - (iy - lines - 1) * Wrap); |
248 | iy = lines; |
249 | ipos(); |
250 | - } else if ((iy < ystatus + 1) || (iy > lines)) { |
251 | + } else if ((iy < ystatus + status_height) || (iy > lines)) { |
252 | logical_refresh(); |
253 | } else { |
254 | ipos(); |
255 | diff -ur tf-50b3/src/varlist.h tfmod/src/varlist.h |
256 | --- tf-50b3/src/varlist.h Tue Jan 6 01:11:05 2004 |
257 | +++ tfmod/src/varlist.h Mon Jan 5 23:35:36 2004 |
258 | @@ -114,6 +114,7 @@ |
259 | varflag(VAR_sockmload, "sockmload", FALSE, NULL) |
260 | varstr (VAR_stat_attr, "status_attr", NULL, ch_status_attr) |
261 | varstr (VAR_stat_fields,"status_fields",NULL, ch_status_fields) |
262 | +varint (VAR_stat_height,"status_height",1, ch_visual) |
263 | varstr (VAR_stat_pad, "status_pad", "_", update_status_line) |
264 | varstr (VAR_stint_clock,"status_int_clock",NULL, ch_status_int) |
265 | varstr (VAR_stint_more, "status_int_more",NULL, ch_status_int) |