mirror of
https://github.com/tmux/tmux.git
synced 2025-03-29 02:08:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
655134f77c
6
colour.c
6
colour.c
@ -189,6 +189,12 @@ colour_fromstring(const char *s)
|
|||||||
return (-1);
|
return (-1);
|
||||||
return (n | COLOUR_FLAG_256);
|
return (n | COLOUR_FLAG_256);
|
||||||
}
|
}
|
||||||
|
if (strncasecmp(s, "color", (sizeof "color") - 1) == 0) {
|
||||||
|
n = strtonum(s + (sizeof "color") - 1, 0, 255, &errstr);
|
||||||
|
if (errstr != NULL)
|
||||||
|
return (-1);
|
||||||
|
return (n | COLOUR_FLAG_256);
|
||||||
|
}
|
||||||
|
|
||||||
if (strcasecmp(s, "default") == 0)
|
if (strcasecmp(s, "default") == 0)
|
||||||
return (8);
|
return (8);
|
||||||
|
@ -170,6 +170,14 @@ static const char *options_table_status_format_default[] = {
|
|||||||
.separator = "" \
|
.separator = "" \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Map of name conversions. */
|
||||||
|
const struct options_name_map options_other_names[] = {
|
||||||
|
{ "display-panes-color", "display-panes-colour" },
|
||||||
|
{ "display-panes-active-color", "display-panes-active-colour" },
|
||||||
|
{ "clock-mode-color", "clock-mode-colour" },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
/* Top-level options. */
|
/* Top-level options. */
|
||||||
const struct options_table_entry options_table[] = {
|
const struct options_table_entry options_table[] = {
|
||||||
/* Server options. */
|
/* Server options. */
|
||||||
|
42
options.c
42
options.c
@ -95,6 +95,18 @@ options_cmp(struct options_entry *lhs, struct options_entry *rhs)
|
|||||||
return (strcmp(lhs->name, rhs->name));
|
return (strcmp(lhs->name, rhs->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
options_map_name(const char *name)
|
||||||
|
{
|
||||||
|
const struct options_name_map *map;
|
||||||
|
|
||||||
|
for (map = options_other_names; map->from != NULL; map++) {
|
||||||
|
if (strcmp(map->from, name) == 0)
|
||||||
|
return (map->to);
|
||||||
|
}
|
||||||
|
return (name);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct options_table_entry *
|
static const struct options_table_entry *
|
||||||
options_parent_table_entry(struct options *oo, const char *s)
|
options_parent_table_entry(struct options *oo, const char *s)
|
||||||
{
|
{
|
||||||
@ -204,10 +216,14 @@ options_next(struct options_entry *o)
|
|||||||
struct options_entry *
|
struct options_entry *
|
||||||
options_get_only(struct options *oo, const char *name)
|
options_get_only(struct options *oo, const char *name)
|
||||||
{
|
{
|
||||||
struct options_entry o;
|
struct options_entry o = { .name = name }, *found;
|
||||||
|
|
||||||
o.name = name;
|
found = RB_FIND(options_tree, &oo->tree, &o);
|
||||||
return (RB_FIND(options_tree, &oo->tree, &o));
|
if (found == NULL) {
|
||||||
|
o.name = options_map_name(name);
|
||||||
|
return (RB_FIND(options_tree, &oo->tree, &o));
|
||||||
|
}
|
||||||
|
return (found);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct options_entry *
|
struct options_entry *
|
||||||
@ -608,19 +624,21 @@ char *
|
|||||||
options_match(const char *s, int *idx, int *ambiguous)
|
options_match(const char *s, int *idx, int *ambiguous)
|
||||||
{
|
{
|
||||||
const struct options_table_entry *oe, *found;
|
const struct options_table_entry *oe, *found;
|
||||||
char *name;
|
char *parsed;
|
||||||
|
const char *name;
|
||||||
size_t namelen;
|
size_t namelen;
|
||||||
|
|
||||||
name = options_parse(s, idx);
|
parsed = options_parse(s, idx);
|
||||||
if (name == NULL)
|
if (parsed == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
namelen = strlen(name);
|
if (*parsed == '@') {
|
||||||
|
|
||||||
if (*name == '@') {
|
|
||||||
*ambiguous = 0;
|
*ambiguous = 0;
|
||||||
return (name);
|
return (parsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
name = options_map_name(parsed);
|
||||||
|
namelen = strlen(name);
|
||||||
|
|
||||||
found = NULL;
|
found = NULL;
|
||||||
for (oe = options_table; oe->name != NULL; oe++) {
|
for (oe = options_table; oe->name != NULL; oe++) {
|
||||||
if (strcmp(oe->name, name) == 0) {
|
if (strcmp(oe->name, name) == 0) {
|
||||||
@ -630,13 +648,13 @@ options_match(const char *s, int *idx, int *ambiguous)
|
|||||||
if (strncmp(oe->name, name, namelen) == 0) {
|
if (strncmp(oe->name, name, namelen) == 0) {
|
||||||
if (found != NULL) {
|
if (found != NULL) {
|
||||||
*ambiguous = 1;
|
*ambiguous = 1;
|
||||||
free(name);
|
free(parsed);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
found = oe;
|
found = oe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(name);
|
free(parsed);
|
||||||
if (found == NULL) {
|
if (found == NULL) {
|
||||||
*ambiguous = 0;
|
*ambiguous = 0;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
9
tmux.h
9
tmux.h
@ -1790,6 +1790,7 @@ enum options_table_type {
|
|||||||
|
|
||||||
struct options_table_entry {
|
struct options_table_entry {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
const char *alternative_name;
|
||||||
enum options_table_type type;
|
enum options_table_type type;
|
||||||
int scope;
|
int scope;
|
||||||
int flags;
|
int flags;
|
||||||
@ -1809,6 +1810,11 @@ struct options_table_entry {
|
|||||||
const char *unit;
|
const char *unit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct options_name_map {
|
||||||
|
const char *from;
|
||||||
|
const char *to;
|
||||||
|
};
|
||||||
|
|
||||||
/* Common command usages. */
|
/* Common command usages. */
|
||||||
#define CMD_TARGET_PANE_USAGE "[-t target-pane]"
|
#define CMD_TARGET_PANE_USAGE "[-t target-pane]"
|
||||||
#define CMD_TARGET_WINDOW_USAGE "[-t target-window]"
|
#define CMD_TARGET_WINDOW_USAGE "[-t target-window]"
|
||||||
@ -2041,7 +2047,8 @@ int options_remove_or_default(struct options_entry *, int,
|
|||||||
char **);
|
char **);
|
||||||
|
|
||||||
/* options-table.c */
|
/* options-table.c */
|
||||||
extern const struct options_table_entry options_table[];
|
extern const struct options_table_entry options_table[];
|
||||||
|
extern const struct options_name_map options_other_names[];
|
||||||
|
|
||||||
/* job.c */
|
/* job.c */
|
||||||
typedef void (*job_update_cb) (struct job *);
|
typedef void (*job_update_cb) (struct job *);
|
||||||
|
Loading…
Reference in New Issue
Block a user