aboutsummaryrefslogtreecommitdiff
path: root/tty-features.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2020-04-24 06:40:30 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2020-04-24 06:40:51 +0100
commit8650f44340e2b4531a7121c7f05cab3e00e3f3c7 (patch)
tree9a99c99a05ce3f3460007f7e9f4c6497a9fd567f /tty-features.c
parentca13208b6be90b3e9a909aeb3a0eec7078d4e3ca (diff)
downloadrtmux-8650f44340e2b4531a7121c7f05cab3e00e3f3c7.tar.gz
rtmux-8650f44340e2b4531a7121c7f05cab3e00e3f3c7.tar.bz2
rtmux-8650f44340e2b4531a7121c7f05cab3e00e3f3c7.zip
Move terminal features into a single file.
Diffstat (limited to 'tty-features.c')
-rw-r--r--tty-features.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/tty-features.c b/tty-features.c
index 7505c96b..d19160ff 100644
--- a/tty-features.c
+++ b/tty-features.c
@@ -201,7 +201,7 @@ tty_add_features(int *feat, const char *s, const char *separators)
char *next, *loop, *copy;
u_int i;
- log_debug("%s: %s", __func__, s);
+ log_debug("adding terminal features %s", s);
loop = copy = xstrdup(s);
while ((next = strsep(&loop, separators)) != NULL) {
@@ -275,3 +275,39 @@ tty_apply_features(struct tty_term *term, int feat)
term->features |= feat;
return (1);
}
+
+void
+tty_default_features(int *feat, const char *name, u_int version)
+{
+ static struct {
+ const char *name;
+ u_int version;
+ const char *features;
+ } table[] = {
+ { .name = "mintty",
+ .features = "256,RGB,ccolour,clipboard,cstyle,margins,overline,title"
+ },
+ { .name = "tmux",
+ .features = "256,RGB,ccolour,clipboard,cstyle,overline,title,usstyle"
+ },
+ { .name = "rxvt-unicode",
+ .features = "256,title"
+ },
+ { .name = "iTerm2",
+ .features = "256,RGB,clipboard,cstyle,margins,sync,title"
+ },
+ { .name = "XTerm",
+ .features = "256,RGB,ccolour,clipboard,cstyle,margins,rectfill,title"
+ }
+ };
+ u_int i;
+
+ for (i = 0; i < nitems(table); i++) {
+ if (strcmp(table[i].name, name) != 0)
+ continue;
+ if (version != 0 && version < table[i].version)
+ continue;
+ tty_add_features(feat, table[i].features, ",");
+ }
+
+}