diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2010-09-11 16:19:22 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2010-09-11 16:19:22 +0000 |
commit | cb564bb427b9db5b1e48a74e6b818454f7ab0c77 (patch) | |
tree | cb4192419ba33d2161c045a3d68ef24758d9d083 /tty-term.c | |
parent | 3696cce4ae83e27ac757bceaad6a0c9fa27525d4 (diff) |
Use UTF-8 line drawing characters on UTF-8 terminals. Fixes some stupid
terminals (I'm looking at you, putty) which disable the vt100 ACS mode
switching sequences in UTF-8 mode.
Also on terminals without ACS at all, use ASCII equivalents where
obvious.
Diffstat (limited to 'tty-term.c')
-rw-r--r-- | tty-term.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -302,6 +302,7 @@ tty_term_find(char *name, int fd, const char *overrides, char **cause) u_int i; int n, error; char *s; + const char *acs; SLIST_FOREACH(term, &tty_terms, entry) { if (strcmp(term->name, name) == 0) { @@ -315,7 +316,7 @@ tty_term_find(char *name, int fd, const char *overrides, char **cause) term->name = xstrdup(name); term->references = 1; term->flags = 0; - memset(&term->codes, 0, sizeof term->codes); + memset(term->codes, 0, sizeof term->codes); SLIST_INSERT_HEAD(&tty_terms, term, entry); /* Set up curses terminal. */ @@ -411,6 +412,15 @@ tty_term_find(char *name, int fd, const char *overrides, char **cause) if (!tty_term_flag(term, TTYC_XENL)) term->flags |= TERM_EARLYWRAP; + /* Generate ACS table. If none is present, use nearest ASCII. */ + memset(term->acs, 0, sizeof term->acs); + if (tty_term_has(term, TTYC_ACSC)) + acs = tty_term_string(term, TTYC_ACSC); + else + acs = "a#j+k+l+m+n+o-p-q-r-s-t+u+v+w+x|y<z>~."; + for (; acs[0] != '\0' && acs[1] != '\0'; acs += 2) + term->acs[(u_char) acs[0]][0] = acs[1]; + return (term); error: |