summaryrefslogtreecommitdiffstats
path: root/screen-redraw.c
diff options
context:
space:
mode:
authornicm <nicm>2019-03-18 20:53:33 +0000
committernicm <nicm>2019-03-18 20:53:33 +0000
commit979313832ce1d5f6cdc2c512e8524d6c517422e0 (patch)
tree13768e951adacd7c96b493a84fb5e65838ef94ed /screen-redraw.c
parentd738d5168804405240a3f36b6f410baee39cd9e0 (diff)
Extend the #[] style syntax and use that together with previous format
changes to allow the status line to be entirely configured with a single option. Now that it is possible to configure their content, enable the existing code that lets the status line be multiple lines in height. The status option can now take a value of 2, 3, 4 or 5 (as well as the previous on or off) to configure more than one line. The new status-format array option configures the format of each line, the default just references the existing status-* options, although some of the more obscure status options may be eliminated in time. Additions to the #[] syntax are: "align" to specify alignment (left, centre, right), "list" for the window list and "range" to configure ranges of text for the mouse bindings. The "align" keyword can also be used to specify alignment of entries in tree mode and the pane status lines.
Diffstat (limited to 'screen-redraw.c')
-rw-r--r--screen-redraw.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/screen-redraw.c b/screen-redraw.c
index 9880433d..691b2194 100644
--- a/screen-redraw.c
+++ b/screen-redraw.c
@@ -274,8 +274,8 @@ screen_redraw_make_pane_status(struct client *c, struct window *w,
struct grid_cell gc;
const char *fmt;
struct format_tree *ft;
- char *out;
- size_t outlen;
+ char *expanded;
+ u_int width, i;
struct screen_write_ctx ctx;
struct screen old;
@@ -289,27 +289,27 @@ screen_redraw_make_pane_status(struct client *c, struct window *w,
ft = format_create(c, NULL, FORMAT_PANE|wp->id, 0);
format_defaults(ft, c, NULL, NULL, wp);
+ expanded = format_expand_time(ft, fmt);
+ wp->status_size = width = wp->sx - 4;
+
memcpy(&old, &wp->status_screen, sizeof old);
- screen_init(&wp->status_screen, wp->sx, 1, 0);
+ screen_init(&wp->status_screen, width, 1, 0);
wp->status_screen.mode = 0;
- out = format_expand(ft, fmt);
- outlen = screen_write_cstrlen("%s", out);
- if (outlen > wp->sx - 4)
- outlen = wp->sx - 4;
- screen_resize(&wp->status_screen, outlen, 1, 0);
-
screen_write_start(&ctx, NULL, &wp->status_screen);
+
+ gc.attr |= GRID_ATTR_CHARSET;
+ for (i = 0; i < width; i++)
+ screen_write_putc(&ctx, &gc, 'q');
+ gc.attr &= ~GRID_ATTR_CHARSET;
+
screen_write_cursormove(&ctx, 0, 0, 0);
- screen_write_clearline(&ctx, 8);
- screen_write_cnputs(&ctx, outlen, &gc, "%s", out);
+ format_draw(&ctx, &gc, width, expanded, NULL);
screen_write_stop(&ctx);
- free(out);
+ free(expanded);
format_free(ft);
- wp->status_size = outlen;
-
if (grid_compare(wp->status_screen.grid, old.grid) == 0) {
screen_free(&old);
return (0);