diff options
author | Ed Schouten <ed@FreeBSD.org> | 2009-01-20 11:34:28 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2009-01-20 11:34:28 +0000 |
commit | 4873b07e2a27bca98f1ef4e1aa7222e236502314 (patch) | |
tree | 6fbf3c838744f4073f214653424b62c333a289d0 /sys/dev/syscons/teken/teken.c | |
parent | b1a4c8e5227657308c5885336ff5416af26eb045 (diff) | |
download | src-4873b07e2a27bca98f1ef4e1aa7222e236502314.tar.gz src-4873b07e2a27bca98f1ef4e1aa7222e236502314.zip |
Properly implement the VT100 SCS sequences in xterm-mode.
Even though VT100-like devices can display non-ASCII characters, they do
not use an 8-bit character set. Special escape sequences allow the VT100
to switch character maps. The special graphics character set stores the
box drawing characters, starting at 0x60, ending at 0x7e. This means
we now pass the character map tests in vttest, even the save/restore
cursor test, combined with character maps. dialog(1) also works a lot
better now.
This commit also includes some other minor fixes:
- Default to 24 lines in teken_demo when using xterm emulation.
- Make white foreground and background work in teken_demo.
Notes
Notes:
svn path=/head/; revision=187469
Diffstat (limited to 'sys/dev/syscons/teken/teken.c')
-rw-r--r-- | sys/dev/syscons/teken/teken.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/sys/dev/syscons/teken/teken.c b/sys/dev/syscons/teken/teken.c index 575ffce61518..3a602552fd2c 100644 --- a/sys/dev/syscons/teken/teken.c +++ b/sys/dev/syscons/teken/teken.c @@ -49,21 +49,27 @@ static FILE *df; #endif /* __FreeBSD__ && _KERNEL */ #include "teken.h" + #ifdef TEKEN_UTF8 #include "teken_wcwidth.h" #else /* !TEKEN_UTF8 */ -static inline int -teken_wcwidth(teken_char_t c __unused) -{ - #ifdef TEKEN_XTERM - return (c <= 0x1B) ? -1 : 1; +#define teken_wcwidth(c) ((c <= 0x1B) ? -1 : 1) #else /* !TEKEN_XTERM */ - return (1); +#define teken_wcwidth(c) (1) #endif /* TEKEN_XTERM */ -} #endif /* TEKEN_UTF8 */ +#if defined(TEKEN_XTERM) && defined(TEKEN_UTF8) +#include "teken_scs.h" +#else /* !(TEKEN_XTERM && TEKEN_UTF8) */ +#define teken_scs_process(t, c) (c) +#define teken_scs_restore(t) +#define teken_scs_save(t) +#define teken_scs_set(t, g, ts) +#define teken_scs_switch(t, g) +#endif /* TEKEN_XTERM && TEKEN_UTF8 */ + /* Private flags for teken_format_t. */ #define TF_REVERSE 0x08 @@ -229,6 +235,14 @@ teken_input_char(teken_t *t, teken_char_t c) case '\x0C': teken_subr_newpage(t); break; +#if defined(TEKEN_XTERM) && defined(TEKEN_UTF8) + case '\x0E': + teken_scs_switch(t, 1); + break; + case '\x0F': + teken_scs_switch(t, 0); + break; +#endif /* TEKEN_XTERM && TEKEN_UTF8 */ case '\r': teken_subr_carriage_return(t); break; |