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.
This commit is contained in:
nicm
2019-03-18 20:53:33 +00:00
parent d738d51688
commit 979313832c
15 changed files with 1338 additions and 561 deletions

60
utf8.c
View File

@ -383,66 +383,6 @@ utf8_cstrwidth(const char *s)
return (width);
}
/* Trim UTF-8 string to width. Caller frees. */
char *
utf8_trimcstr(const char *s, u_int width)
{
struct utf8_data *tmp, *next;
char *out;
u_int at;
tmp = utf8_fromcstr(s);
at = 0;
for (next = tmp; next->size != 0; next++) {
if (at + next->width > width) {
next->size = 0;
break;
}
at += next->width;
}
out = utf8_tocstr(tmp);
free(tmp);
return (out);
}
/* Trim UTF-8 string to width. Caller frees. */
char *
utf8_rtrimcstr(const char *s, u_int width)
{
struct utf8_data *tmp, *next, *end;
char *out;
u_int at;
tmp = utf8_fromcstr(s);
for (end = tmp; end->size != 0; end++)
/* nothing */;
if (end == tmp) {
free(tmp);
return (xstrdup(""));
}
next = end - 1;
at = 0;
for (;;) {
if (at + next->width > width) {
next++;
break;
}
at += next->width;
if (next == tmp)
break;
next--;
}
out = utf8_tocstr(next);
free(tmp);
return (out);
}
/* Pad UTF-8 string to width. Caller frees. */
char *
utf8_padcstr(const char *s, u_int width)