mirror of
https://github.com/tmux/tmux.git
synced 2026-06-21 09:45:41 +00:00
Merge branch 'obsd-master'
This commit is contained in:
@@ -442,6 +442,45 @@ tty_get_features(int feat)
|
||||
return (s);
|
||||
}
|
||||
|
||||
int
|
||||
tty_feature_present(struct tty_term *term, const char *name)
|
||||
{
|
||||
const struct tty_feature *tf = NULL;
|
||||
const char *const *capability;
|
||||
u_int i;
|
||||
char *copy;
|
||||
|
||||
for (i = 0; i < nitems(tty_features); i++) {
|
||||
tf = tty_features[i];
|
||||
if (strcmp(tf->name, name) == 0) {
|
||||
if (term->features & (1 << i))
|
||||
return (1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We don't just have the feature flag set. Check if the capabilities
|
||||
* supported by the client are actual set instead.
|
||||
*/
|
||||
if (tf == NULL || strcmp(name, "ignorefkeys") == 0)
|
||||
return (0);
|
||||
if (tf->flags != 0 && (term->flags & tf->flags) != tf->flags)
|
||||
return (0);
|
||||
capability = tf->capabilities;
|
||||
while (*capability != NULL) {
|
||||
copy = xstrdup(*capability);
|
||||
copy[strcspn(copy, "=")] = '\0';
|
||||
if (!tty_term_has_name(term, copy)) {
|
||||
free(copy);
|
||||
return (0);
|
||||
}
|
||||
free(copy);
|
||||
capability++;
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
tty_apply_features(struct tty_term *term, int feat)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user