Commit Graph

20 Commits

Author SHA1 Message Date
Graham Clark de4e5c4494 Fix control-character encoding for non-alphabet characters
@klamonte opened this issue against gowid, a package that relies on tcell for
all its terminal handling: https://github.com/gcla/gowid/issues/24. It
describes how a shell inside a terminal widget that the TUI launches freezes
when the user hits backspace. The TUI loads a tcell TermInfo struct for the
screen-256color terminal and that struct codes KeyBackspace as the single byte
0xff - and so the byte 0xff was sent to the tty. On my Ubuntu 19.04 machine,
`infocmp screen-256color` shows `kbs` is `^?` According to
https://en.wikipedia.org/wiki/Caret_notation, `^?` should map to 0x7f (127) -
"The digraph stands for the control character whose ASCII code is the same as
the character's ASCII code with the uppermost bit, in a 7-bit encoding,
reversed". This affects both mkinfo.go, the generator of the JSON terminfo
database files, and the dynamic terminfo generator.
2020-01-13 20:44:03 -08:00
Cole Helbling ae1dc54d2c Add terminfo for Alacritty 2019-08-05 09:28:43 -07:00
Asger Hautop Drewsen 4e7865679e Add terminfo for kitty (#283) 2019-08-01 11:20:19 -07:00
Garrett D'Amore fef653e8d0 Update README for new mkinfo 2019-07-29 22:47:04 -07:00
Garrett D'Amore 1922b3786e fixes #252 database cannot be distributed in static binary 2019-07-23 19:39:55 -07:00
Garrett D'Amore 84b54971b4 fixes #294 Baud rate should not matter 2019-07-23 19:03:31 -07:00
Garrett D'Amore ca8fb5bcc9 fixes #279 process new terminal descriptions at application runtime
fixes #285 Loss of color/mangled formatting on GNU screen
fixes #93 use the terminfo database instead of the json database

This change falls back to using a dynamically generated terminal
description (using infocmp, which must be on the path) if the builtin
database doesn't have a suitable description.

For most users this should resolve the problem of unknown terminals.
2019-06-12 23:38:18 -07:00
Garrett D'Amore 77ab683d7d Improve 24-bit color support.
This expands support for 24-bit color for terminals that support the
ISO 8613-6:1994 escape sequences (same as xterm), allowing this support
to be enabled by setting % COLORTERM to "truecolor" (or 24bit or 24-bit),
or by setting TCELL_TRUECOLOR to "on", or by setting $TERM a value that
ends in the word "-truecolor".

As this is handled by the runtime now, we no longer need to create magical
database entries for -truecolor options.

A colors.go demo is provided to show off 24-bit color support.
2019-03-18 22:47:05 -07:00
Garrett D'Amore af444b941a Refactor tests to avoid go-convey.
While go-convey was pretty nice, it carries a rather large dependency
graph, which we think it is better not to burden our downstreams with.
It is easy enough to just refactor the tests to use the standard testing
package.
2018-12-18 21:33:43 -08:00
Garrett D'Amore 493f3b46b3 fixes #225 Kitty missing from terminfo database 2018-09-23 22:52:37 -07:00
Martin Angers 2efc922424 add termite terminfo 2018-06-23 12:51:08 -07:00
Thomas Wouters 5ddf16a669 Allow octal and hexadecimal conversion to int
Auto detect the base as implied by `0` or `0x` prefixes.

Fixes #212
2018-04-23 06:10:09 -07:00
Garrett D'Amore 2f258105ca fixes #197 Problem on case insensitive filesystem
This changes the database to use sha1 based file names.  Its not
beautiful, but this is the BS we have to do to cope with the garbage
that is case insensitive filesystems.

Legacy databases are still honored, if you have them.
2018-04-16 09:37:43 -07:00
Jason E. Aten 1ef2313da8 fix #172, don't crash on empty name string on call to LookupTerminfo 2018-01-08 08:47:47 -08:00
Joshua T Corbin 426c2dbca3 Update terminfo database 2017-12-25 02:11:46 -08:00
Graham Clark 996a3f0a68 Fix up the two screen terminfo sgr0 sequences. 2017-12-17 15:52:28 -08:00
Graham Clark 99cec24157 Parse terminfo values containing numbers expressed in octal syntax.
I noticed that when running a tcell application under tmux using
TERM=screen-256color, some text rendered with style attributes
like bold and underline appeared preceded with "17". This seemed
to come from tcell sending "AttrOff"/sgr0, which in
term_screen_256xcolor.go looks like:

AttrOff:      "\x1b[m\x0017"

infocmp screen-256color expresses sgr0 like this:

sgr0=\E[m\017

This terminfo man page implies that \017 should be interpreted as
the octal representation of 15 decimal.

https://www.mkssoftware.com/docs/man5/terminfo.5.asp

The terminfo generator mkinfo.go parses the \0 as a zero, then
the following 17 as the digits 1 and 7. This patch modifies
mkinfo.go and results in the following instead

AttrOff:      "\x1b[m\x0f"

This seems to clear up the "17" problem for me. But I am not a
terminal expert by any means, so perhaps my interpretation is
incorrect!
2017-12-17 15:52:28 -08:00
Garrett D'Amore ade89fc294 Add st terminal entries (www.suckless.org)
We add st, st-meta, and the -256color and -truecolor variants.
Note that the -truecolor variant was NOT described in the st.info
file, but st uses the same color escapes that everyone else does
for 24-bit color.
2017-11-24 15:27:54 -08:00
Garrett D'Amore c0b0191744 Fix database for case insensitive file systems and truecolor. 2017-11-24 14:14:35 -08:00
Garrett D'Amore 8f08469772 fixes #167 Break up the database
This completely restructures the database of terminal types, putting
each terminal in its own file.  We also compress the database files,
and use infocmp instead of trying to use the C level API.

The mkdatabase script will rebuild the entire database from the terminfo
files on the system.  Individual entries can also be built by simply running
the mkinfo program with the terminal type.
2017-11-24 13:13:06 -08:00