From 1b86f520ea1620628e569ea833c7b13306c18a4e Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 12 Nov 2015 11:09:11 +0000 Subject: Nuke the utf8 and status-utf8 options and make tmux only a UTF-8 terminal. We still support non-UTF-8 terminals outside tmux, but inside it is always UTF-8 (as when the utf8 and status-utf8 options were on). --- tmux.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'tmux.c') diff --git a/tmux.c b/tmux.c index 1e68d9bb..9f9f9a50 100644 --- a/tmux.c +++ b/tmux.c @@ -291,12 +291,6 @@ main(int argc, char **argv) global_w_options = options_create(NULL); options_table_populate_tree(window_options_table, global_w_options); - /* Enable UTF-8 if the first client is on UTF-8 terminal. */ - if (flags & CLIENT_UTF8) { - options_set_number(global_s_options, "status-utf8", 1); - options_set_number(global_w_options, "utf8", 1); - } - /* Override keys to vi if VISUAL or EDITOR are set. */ if ((s = getenv("VISUAL")) != NULL || (s = getenv("EDITOR")) != NULL) { if (strrchr(s, '/') != NULL) -- cgit From 0cc812ae342d1a71c0337db8ffb4d7701668cb38 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 12 Nov 2015 11:24:08 +0000 Subject: tmux is UTF-8, so if $TMUX is set (tmux running in tmux), the client is UTF-8. Also try to make the existing checks more readable. --- tmux.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'tmux.c') diff --git a/tmux.c b/tmux.c index 9f9f9a50..5429a7cb 100644 --- a/tmux.c +++ b/tmux.c @@ -191,8 +191,9 @@ find_home(void) int main(int argc, char **argv) { - char *s, *path, *label, **var, tmp[PATH_MAX]; - int opt, flags, keys; + char *path, *label, **var, tmp[PATH_MAX]; + const char *s; + int opt, flags, keys; #ifdef DEBUG malloc_options = (char *) "AFGJPX"; @@ -258,20 +259,25 @@ main(int argc, char **argv) "proc exec tty ps", NULL) != 0) err(1, "pledge"); - if (!(flags & CLIENT_UTF8)) { - /* - * If the user has set whichever of LC_ALL, LC_CTYPE or LANG - * exist (in that order) to contain UTF-8, it is a safe - * assumption that either they are using a UTF-8 terminal, or - * if not they know that output from UTF-8-capable programs may - * be wrong. - */ - if ((s = getenv("LC_ALL")) == NULL || *s == '\0') { - if ((s = getenv("LC_CTYPE")) == NULL || *s == '\0') - s = getenv("LANG"); - } - if (s != NULL && (strcasestr(s, "UTF-8") != NULL || - strcasestr(s, "UTF8") != NULL)) + /* + * tmux is a UTF-8 terminal, so if TMUX is set, assume UTF-8. + * Otherwise, if the user has set LC_ALL, LC_CTYPE or LANG to contain + * UTF-8, it is a safe assumption that either they are using a UTF-8 + * terminal, or if not they know that output from UTF-8-capable + * programs may be wrong. + */ + if (getenv("TMUX") != NULL) + flags |= CLIENT_UTF8; + else { + s = getenv("LC_ALL"); + if (s == NULL || *s == '\0') + s = getenv("LC_CTYPE"); + if (s == NULL || *s == '\0') + s = getenv("LANG"); + if (s == NULL || *s == '\0') + s = ""; + if (strcasestr(s, "UTF-8") != NULL || + strcasestr(s, "UTF8") != NULL) flags |= CLIENT_UTF8; } -- cgit