mirror of
https://github.com/tmux/tmux.git
synced 2025-01-13 03:48:51 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
58908b045b
10
cmd-parse.y
10
cmd-parse.y
@ -745,6 +745,12 @@ cmd_parse_from_file(FILE *f, struct cmd_parse_input *pi)
|
|||||||
|
|
||||||
struct cmd_parse_result *
|
struct cmd_parse_result *
|
||||||
cmd_parse_from_string(const char *s, struct cmd_parse_input *pi)
|
cmd_parse_from_string(const char *s, struct cmd_parse_input *pi)
|
||||||
|
{
|
||||||
|
return (cmd_parse_from_buffer(s, strlen(s), pi));
|
||||||
|
}
|
||||||
|
|
||||||
|
struct cmd_parse_result *
|
||||||
|
cmd_parse_from_buffer(const void *buf, size_t len, struct cmd_parse_input *pi)
|
||||||
{
|
{
|
||||||
static struct cmd_parse_result pr;
|
static struct cmd_parse_result pr;
|
||||||
struct cmd_parse_input input;
|
struct cmd_parse_input input;
|
||||||
@ -757,14 +763,14 @@ cmd_parse_from_string(const char *s, struct cmd_parse_input *pi)
|
|||||||
}
|
}
|
||||||
memset(&pr, 0, sizeof pr);
|
memset(&pr, 0, sizeof pr);
|
||||||
|
|
||||||
if (*s == '\0') {
|
if (len == 0) {
|
||||||
pr.status = CMD_PARSE_EMPTY;
|
pr.status = CMD_PARSE_EMPTY;
|
||||||
pr.cmdlist = NULL;
|
pr.cmdlist = NULL;
|
||||||
pr.error = NULL;
|
pr.error = NULL;
|
||||||
return (&pr);
|
return (&pr);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmds = cmd_parse_do_buffer(s, strlen(s), pi, &cause);
|
cmds = cmd_parse_do_buffer(buf, len, pi, &cause);
|
||||||
if (cmds == NULL) {
|
if (cmds == NULL) {
|
||||||
pr.status = CMD_PARSE_ERROR;
|
pr.status = CMD_PARSE_ERROR;
|
||||||
pr.error = cause;
|
pr.error = cause;
|
||||||
|
@ -598,6 +598,8 @@ mode_tree_draw(struct mode_tree_data *mtd)
|
|||||||
xasprintf(&text, "%-*s%s%s%s: ", keylen, key, start, mti->name,
|
xasprintf(&text, "%-*s%s%s%s: ", keylen, key, start, mti->name,
|
||||||
tag);
|
tag);
|
||||||
width = utf8_cstrwidth(text);
|
width = utf8_cstrwidth(text);
|
||||||
|
if (width > w)
|
||||||
|
width = w;
|
||||||
free(start);
|
free(start);
|
||||||
|
|
||||||
if (mti->tagged) {
|
if (mti->tagged) {
|
||||||
@ -607,11 +609,11 @@ mode_tree_draw(struct mode_tree_data *mtd)
|
|||||||
|
|
||||||
if (i != mtd->current) {
|
if (i != mtd->current) {
|
||||||
screen_write_clearendofline(&ctx, 8);
|
screen_write_clearendofline(&ctx, 8);
|
||||||
screen_write_puts(&ctx, &gc0, "%s", text);
|
screen_write_nputs(&ctx, w, &gc0, "%s", text);
|
||||||
format_draw(&ctx, &gc0, w - width, mti->text, NULL);
|
format_draw(&ctx, &gc0, w - width, mti->text, NULL);
|
||||||
} else {
|
} else {
|
||||||
screen_write_clearendofline(&ctx, gc.bg);
|
screen_write_clearendofline(&ctx, gc.bg);
|
||||||
screen_write_puts(&ctx, &gc, "%s", text);
|
screen_write_nputs(&ctx, w, &gc, "%s", text);
|
||||||
format_draw(&ctx, &gc, w - width, mti->text, NULL);
|
format_draw(&ctx, &gc, w - width, mti->text, NULL);
|
||||||
}
|
}
|
||||||
free(text);
|
free(text);
|
||||||
|
Loading…
Reference in New Issue
Block a user