diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-03-18 20:53:34 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-03-18 20:53:34 +0000 |
commit | 3bb806a0239745a111db415452d29361b93fed90 (patch) | |
tree | 3a29d073f53ee163ee5311948668199e2d401937 /usr.bin/tmux/mode-tree.c | |
parent | 895342f95f7da02f950bdba0f9a4f44e504e00ad (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 'usr.bin/tmux/mode-tree.c')
-rw-r--r-- | usr.bin/tmux/mode-tree.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/tmux/mode-tree.c b/usr.bin/tmux/mode-tree.c index d89b4840507..39903ca762f 100644 --- a/usr.bin/tmux/mode-tree.c +++ b/usr.bin/tmux/mode-tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mode-tree.c,v 1.26 2019/03/12 20:02:47 nicm Exp $ */ +/* $OpenBSD: mode-tree.c,v 1.27 2019/03/18 20:53:33 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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); |