]> git.pld-linux.org Git - packages/tf.git/blob - tf-50b5-multistatus.patch
- multistatus patch for tf-50b5,
[packages/tf.git] / tf-50b5-multistatus.patch
1 diff -ur tf-50b5/src/globals.h tf-50b5-patch/src/globals.h
2 --- tf-50b5/src/globals.h       Wed Jul 21 02:19:41 2004
3 +++ tf-50b5-patch/src/globals.h Wed Jul 28 00:21:15 2004
4 @@ -223,6 +223,7 @@
5  #define status_attr    getattrvar(VAR_stat_attr)
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-50b5/src/main.c tf-50b5-patch/src/main.c
13 --- tf-50b5/src/main.c  Fri Jul 16 23:13:51 2004
14 +++ tf-50b5-patch/src/main.c    Wed Jul 28 00:21:15 2004
15 @@ -49,7 +49,7 @@
16  #endif
17      "TinyFugue version 5.0 beta 5";
18  
19 -const char mods[] = "";
20 +const char mods[] = "With multistatus line written by Someone [Minor changes by Karol Lassak (ingwar@ingwar.eu.org)]";
21  
22  const char copyright[] =
23      "Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004 Ken Keys (hawkeye@tcp.com)";
24 diff -ur tf-50b5/src/output.c tf-50b5-patch/src/output.c
25 --- tf-50b5/src/output.c        Tue Jul 27 03:02:34 2004
26 +++ tf-50b5-patch/src/output.c  Wed Jul 28 00:21:15 2004
27 @@ -15,6 +15,8 @@
28   * Handles all screen-related phenomena.
29   *****************************************************************/
30  
31 +#define MAX_STATUS_HEIGHT 5
32 +
33  #define TERM_vt100     1
34  #define TERM_vt220     2
35  #define TERM_ansi      3
36 @@ -388,15 +390,15 @@
37      lines = ((str = getvar("LINES"))) ? atoi(str) : 0;
38      columns = ((str = getvar("COLUMNS"))) ? atoi(str) : 0;
39      if (lines <= 0 || columns <= 0) get_window_size();
40 -    ystatus = lines - isize;
41 +    ystatus = lines - isize - (status_height - 1);
42      top_margin = 1;
43      bottom_margin = lines;
44  
45      prompt = fgprompt();
46  
47      init_term();
48 -    Stringninit(status_line, columns);
49 -    check_charattrs(status_line, columns, 0, __FILE__, __LINE__);
50 +    Stringninit(status_line, columns * MAX_STATUS_HEIGHT);
51 +    check_charattrs(status_line, columns * MAX_STATUS_HEIGHT, 0, __FILE__, __LINE__);
52      ch_attr(&special_var[VAR_hiliteattr]);
53      ch_attr(&special_var[VAR_alert_attr]);
54      ch_attr(&special_var[VAR_stat_attr]);
55 @@ -686,7 +688,7 @@
56      } else {
57          prompt = fgprompt();
58          if (isize > lines - 3) set_var_by_id(VAR_isize, lines - 3);
59 -        ystatus = lines - isize;
60 +        ystatus = lines - isize - (status_height - 1);
61  #if 0
62          outcount = ystatus - 1;
63  #endif
64 @@ -697,7 +699,7 @@
65          }
66          update_status_line(NULL);
67          ix = iendx = oy = 1;
68 -        iy = iendy = istarty = ystatus + 1;
69 +        iy = iendy = istarty = ystatus + status_height;
70          ipos();
71  #endif
72      }
73 @@ -1314,9 +1316,9 @@
74          inlist(field, status_field_list, status_field_list->tail);
75      }
76  
77 -    if (width > columns) {
78 -        eprintf("status_fields: status width (%d) is wider than screen (%d)",
79 -           width, columns);
80 +    if (width > columns * status_height) {
81 +        eprintf("status_fields: status width (%d) is wider than screen * status height (%d * %d)",
82 +           width, columns, status_height);
83      }
84  
85      /* update new fields */
86 @@ -1408,21 +1410,21 @@
87  {
88      int column;
89      if (field->column >= 0)
90 -       return (field->column > columns) ? columns : field->column;
91 +       return (field->column > columns * status_height) ? columns * status_height : field->column;
92      column = field->column +
93 -       ((status_left + status_right > columns) ?
94 -       status_left + status_right : columns);
95 -    return (column > columns) ? columns : column;
96 +       ((status_left + status_right > columns * status_height) ?
97 +       status_left + status_right : columns * status_height);
98 +    return (column > columns * status_height) ? columns * status_height : column;
99  }
100  
101  static int status_width(StatusField *field, int start)
102  {
103      int width;
104 -    if (start >= columns) return 0;
105 -    width = (field->width == 0) ? columns - status_right - status_left :
106 +    if (start >= columns * status_height) return 0;
107 +    width = (field->width == 0) ? columns * status_height - status_right - status_left :
108         (field->width > 0) ? field->width : -field->width;
109 -    if (width > columns - start)
110 -        width = columns - start;
111 +    if (width > columns * status_height - start)
112 +        width = columns * status_height - start;
113      if (width < 0)
114         width = 0;
115      return width;
116 @@ -1580,8 +1582,8 @@
117                 continue;
118         }
119          if (internal >= 0 && field->internal != internal) continue;
120 -       column = status_field_column(field);
121 -       if (column >= columns) /* doesn't fit, nor will any later fields */
122 +           column = status_field_column(field);
123 +           if (column >= columns * status_height) /* doesn't fit, nor will any later fields */
124             break;
125         count++;
126          width = format_status_field(field);
127 @@ -1590,17 +1592,17 @@
128             column >= alert_pos + alert_len)
129         {
130             /* no overlap with alert */
131 -           xy(column + 1, ystatus);
132 +           xy((column + 1) % columns, ystatus + (column / columns));
133             hwrite(CS(status_line), column, width, 0);
134         } else {
135             if (column < alert_pos) {
136                 /* field starts left of alert */
137 -               xy(column + 1, ystatus);
138 +           xy((column + 1) % columns, ystatus + (column / columns));
139                 hwrite(CS(status_line), column, alert_pos - column, 0);
140             }
141             if (column + width >= alert_pos) {
142                 /* field ends right of alert */
143 -               xy(alert_pos + alert_len + 1, ystatus);
144 +           xy((alert_pos + alert_len + 1) % columns, ystatus + (column / columns));
145                 hwrite(CS(status_line), alert_pos + alert_len,
146                     column + width - (alert_pos + alert_len), 0);
147             }
148 @@ -1622,12 +1624,12 @@
149      for (node = status_field_list->head; node; node = node->next) {
150          field = (StatusField*)node->datum;
151  
152 -       if ((column = status_field_column(field)) >= columns)
153 +       if ((column = status_field_column(field)) >= columns * status_height)
154             break;
155          width = format_status_field(field);
156      }
157  
158 -    for (column += width; column < columns; column++) {
159 +    for (column += width; column < columns * status_height; column++) {
160         status_line->data[column] = true_status_pad;
161         status_line->charattrs[column] = status_attr;
162      }
163 @@ -1635,23 +1637,33 @@
164  
165  int display_status_line(void)
166  {
167 +    int i;
168      if (screen_mode < 1) return 0;
169  
170      if (!alert_len) {
171         /* no overlap with alert */
172 -       xy(1, ystatus);
173 -       hwrite(CS(status_line), 0, columns, 0);
174 +           for (i = 0; i < status_height; i++) {
175 +               xy(1, ystatus + i);
176 +               hwrite(CS(status_line), (columns * i), columns, 0);
177 +        }
178      } else {
179         /* overlap with alert (this could happen in ch_status_attr()) */
180 -       if (alert_pos > 0) {
181 -           xy(1, ystatus);
182 -           hwrite(CS(status_line), 0, alert_pos, 0);
183 -       }
184 -       if (alert_pos + alert_len < columns) {
185 -           xy(alert_pos + alert_len + 1, ystatus);
186 -           hwrite(CS(status_line), alert_pos + alert_len,
187 -               columns - (alert_pos + alert_len), 0);
188 -       }
189 +       for (i = 0; i < status_height; i++) {
190 +        if (!i) {
191 +               if (alert_pos > 0) {
192 +                   xy(1, ystatus);
193 +                   hwrite(CS(status_line), 0, alert_pos, 0);
194 +               }
195 +               if (alert_pos + alert_len < columns) {
196 +                   xy(alert_pos + alert_len + 1, ystatus);
197 +                   hwrite(CS(status_line), alert_pos + alert_len,
198 +                       columns - (alert_pos + alert_len), 0);
199 +               }
200 +      } else {
201 +               xy(1, ystatus + i);
202 +                hwrite(CS(status_line), (columns * i), columns, 0);
203 +         }
204 +     }
205      }
206  
207      bufflush();
208 @@ -1744,9 +1756,9 @@
209  {
210      int need_redraw;
211  
212 -    if (status_line->len < columns)
213 -       Stringnadd(status_line, '?', columns - status_line->len);
214 -    Stringtrunc(status_line, columns);
215 +    if (status_line->len < columns * status_height)
216 +       Stringnadd(status_line, '?', columns * status_height - status_line->len);
217 +    Stringtrunc(status_line, columns * status_height);
218  
219      if (screen_mode < 0) {                /* e.g., called by init_variables() */
220          need_redraw = 0;
221 @@ -1760,6 +1772,11 @@
222  #ifdef SCREEN
223      } else if (var == &special_var[VAR_isize]) {      /* %isize changed */
224          need_redraw = 1;
225 +    } else if (var == &special_var[VAR_stat_height]) {      /* %status_height changed */
226 +        if (status_height > MAX_STATUS_HEIGHT) {
227 +          set_var_by_id(VAR_stat_height, MAX_STATUS_HEIGHT);
228 +        } 
229 +        need_redraw = 1;
230      } else {                              /* SIGWINCH */
231          /* Set ystatus to the top of the area fix_screen() must erase. */
232          /* ystatus = 1; */
233 @@ -1853,9 +1870,9 @@
234  static void clear_input_window(void)
235  {
236      /* only called in visual mode */
237 -    clear_lines(ystatus + 1, lines);
238 +    clear_lines(ystatus + status_height, lines);
239      ix = iendx = 1;
240 -    iy = iendy = istarty = ystatus + 1;
241 +    iy = iendy = istarty = ystatus + status_height;
242      ipos();
243  }
244  
245 @@ -1873,14 +1890,14 @@
246  static void scroll_input(int n)
247  {
248      if (n > isize) {
249 -        clear_lines(ystatus + 1, lines);
250 -        iendy = ystatus + 1;
251 +        clear_lines(ystatus + status_height, lines);
252 +        iendy = ystatus + status_height;
253      } else if (delete_line) {
254 -        xy(1, ystatus + 1);
255 +        xy(1, ystatus + status_height);
256          for (iendy = lines + 1; iendy > lines - n + 1; iendy--)
257              tp(delete_line);
258      } else if (has_scroll_region) {
259 -        setscroll(ystatus + 1, lines);
260 +        setscroll(ystatus + status_height, lines);
261          xy(1, lines);
262          crnl(n);  /* DON'T: cy += n; */
263          iendy = lines - n + 1;
264 @@ -2039,7 +2056,7 @@
265             }
266          } else if (scroll && !clearfull) {
267              scroll_input(1);
268 -            if (istarty > ystatus + 1) istarty--;
269 +            if (istarty > ystatus + status_height) istarty--;
270          } else {
271              clear_input_window();
272          }
273 @@ -2273,7 +2290,7 @@
274              ioutall(place - (ix - 1) - (iy - lines - 1) * Wrap);
275              iy = lines;
276              ipos();
277 -        } else if ((iy < ystatus + 1) || (iy > lines)) {
278 +        } else if ((iy < ystatus + status_height) || (iy > lines)) {
279              logical_refresh();
280          } else {
281              ipos();
282 diff -ur tf-50b5/src/varlist.h tf-50b5-patch/src/varlist.h
283 --- tf-50b5/src/varlist.h       Mon Jul 26 10:30:56 2004
284 +++ tf-50b5-patch/src/varlist.h Wed Jul 28 00:21:15 2004
285 @@ -128,6 +128,7 @@
286  varstr (VAR_sprefix,   "sprefix",      NULL,           NULL)
287  varstr (VAR_stat_attr, "status_attr",  NULL,           ch_status_attr)
288  varstr (VAR_stat_fields,"status_fields",NULL,          ch_status_fields)
289 +varint (VAR_stat_height,"status_height",1,             ch_visual)
290  varstr (VAR_stat_pad,  "status_pad",   "_",            update_status_line)
291  varstr (VAR_stint_clock,"status_int_clock",NULL,       ch_status_int)
292  varstr (VAR_stint_more,        "status_int_more",NULL,         ch_status_int)
This page took 0.089934 seconds and 3 git commands to generate.