version 1.95, 2019/05/03 20:44:24 |
version 1.96, 2019/10/15 08:25:37 |
|
|
|
|
.args = { "bc:de:fF:hIl:p:Pt:v", 0, -1 }, |
.args = { "bc:de:fF:hIl:p:Pt:v", 0, -1 }, |
.usage = "[-bdefhIPv] [-c start-directory] [-e environment] " |
.usage = "[-bdefhIPv] [-c start-directory] [-e environment] " |
"[-F format] [-p percentage|-l size] " CMD_TARGET_PANE_USAGE |
"[-F format] [-l size] " CMD_TARGET_PANE_USAGE " [command]", |
" [command]", |
|
|
|
.target = { 't', CMD_FIND_PANE, 0 }, |
.target = { 't', CMD_FIND_PANE, 0 }, |
|
|
|
|
struct layout_cell *lc; |
struct layout_cell *lc; |
struct cmd_find_state fs; |
struct cmd_find_state fs; |
int size, percentage, flags, input; |
int size, percentage, flags, input; |
const char *template, *add; |
const char *template, *add, *errstr, *p; |
char *cause, *cp; |
char *cause, *cp, *copy; |
|
size_t plen; |
struct args_value *value; |
struct args_value *value; |
|
|
if (args_has(args, 'h')) |
if (args_has(args, 'h')) |
type = LAYOUT_LEFTRIGHT; |
type = LAYOUT_LEFTRIGHT; |
else |
else |
type = LAYOUT_TOPBOTTOM; |
type = LAYOUT_TOPBOTTOM; |
if (args_has(args, 'l')) { |
if ((p = args_get(args, 'l')) != NULL) { |
size = args_strtonum(args, 'l', 0, INT_MAX, &cause); |
plen = strlen(p); |
if (cause != NULL) { |
if (p[plen - 1] == '%') { |
cmdq_error(item, "create pane failed: -l %s", cause); |
copy = xstrdup(p); |
free(cause); |
copy[plen - 1] = '\0'; |
return (CMD_RETURN_ERROR); |
percentage = strtonum(copy, 0, INT_MAX, &errstr); |
|
free(copy); |
|
if (errstr != NULL) { |
|
cmdq_error(item, "percentage %s", errstr); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
if (type == LAYOUT_TOPBOTTOM) |
|
size = (wp->sy * percentage) / 100; |
|
else |
|
size = (wp->sx * percentage) / 100; |
|
} else { |
|
size = args_strtonum(args, 'l', 0, INT_MAX, &cause); |
|
if (cause != NULL) { |
|
cmdq_error(item, "lines %s", cause); |
|
free(cause); |
|
return (CMD_RETURN_ERROR); |
|
} |
} |
} |
} else if (args_has(args, 'p')) { |
} else if (args_has(args, 'p')) { |
percentage = args_strtonum(args, 'p', 0, INT_MAX, &cause); |
percentage = args_strtonum(args, 'p', 0, INT_MAX, &cause); |