diff options
author | nicm <nicm> | 2019-03-18 20:53:33 +0000 |
---|---|---|
committer | nicm <nicm> | 2019-03-18 20:53:33 +0000 |
commit | 979313832ce1d5f6cdc2c512e8524d6c517422e0 (patch) | |
tree | 13768e951adacd7c96b493a84fb5e65838ef94ed /mode-tree.c | |
parent | d738d5168804405240a3f36b6f410baee39cd9e0 (diff) | |
download | rtmux-979313832ce1d5f6cdc2c512e8524d6c517422e0.tar.gz rtmux-979313832ce1d5f6cdc2c512e8524d6c517422e0.tar.bz2 rtmux-979313832ce1d5f6cdc2c512e8524d6c517422e0.zip |
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 'mode-tree.c')
-rw-r--r-- | mode-tree.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/mode-tree.c b/mode-tree.c index 112969ea..60e23534 100644 --- a/mode-tree.c +++ b/mode-tree.c @@ -497,7 +497,7 @@ mode_tree_draw(struct mode_tree_data *mtd) struct options *oo = wp->window->options; struct screen_write_ctx ctx; struct grid_cell gc0, gc; - u_int w, h, i, j, sy, box_x, box_y; + u_int w, h, i, j, sy, box_x, box_y, width; char *text, *start, key[7]; const char *tag, *symbol; size_t size, n; @@ -572,8 +572,9 @@ mode_tree_draw(struct mode_tree_data *mtd) tag = "*"; else tag = ""; - xasprintf(&text, "%-*s%s%s%s: %s", keylen, key, start, - mti->name, tag, mti->text); + xasprintf(&text, "%-*s%s%s%s: ", keylen, key, start, mti->name, + tag); + width = utf8_cstrwidth(text); free(start); if (mti->tagged) { @@ -582,11 +583,13 @@ mode_tree_draw(struct mode_tree_data *mtd) } if (i != mtd->current) { - screen_write_cnputs(&ctx, w, &gc0, "%s", text); screen_write_clearendofline(&ctx, 8); + screen_write_puts(&ctx, &gc0, "%s", text); + format_draw(&ctx, &gc0, w - width, mti->text, NULL); } else { - screen_write_cnputs(&ctx, w, &gc, "%s", text); screen_write_clearendofline(&ctx, gc.bg); + screen_write_puts(&ctx, &gc, "%s", text); + format_draw(&ctx, &gc, w - width, mti->text, NULL); } free(text); |