Add non-standard terminfo capabilities

Advertises support for truecolor and styled underlines.
The truecolor properties are used by at least tmux and neovim.
This commit is contained in:
Kovid Goyal 2018-02-08 10:26:13 +05:30
parent 77d46630d7
commit 2ab6f57159
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 19 additions and 4 deletions

View File

@ -15,7 +15,7 @@ with open('terminfo/kitty.terminfo', 'w') as f:
f.write(generate_terminfo())
os.environ['TERMINFO'] = os.path.join(base, 'terminfo')
subprocess.check_call(['tic', 'terminfo/kitty.terminfo'])
subprocess.check_call(['tic', '-x', 'terminfo/kitty.terminfo'])
# On OS X tic puts the compiled database into a different directory
try:
os.mkdir('terminfo/78')

View File

@ -38,8 +38,14 @@ def safe_print(*a, **k):
'xenl',
# has extra status line (window title)
'hs',
# Terminfo extension used by tmux to detect true color support (non-standard)
'Tc',
# Indicates support for styled and colored underlines (non-standard) as
# described at:
# https://github.com/kovidgoyal/kitty/blob/master/protocol-extensions.asciidoc
'Su',
# The following are entries from termite's terminfo that we dont need
# The following are entries that we dont use
# # background color erase
# 'bce',
}
@ -266,8 +272,12 @@ def safe_print(*a, **k):
'ka3': r'',
'kc1': r'',
'kc3': r'',
# Set RGB foreground color (non-standard used by neovim)
'setrgbf': r'\E[38:2:%p1%d:%p2%d:%p3%dm',
# Set RGB background color (non-standard used by neovim)
'setrgbb': r'\E[48:2:%p1%d:%p2%d:%p3%dm',
# The following are entries from termite's terminfo that we dont need
# The following are entries that we dont use
# # display status line
# 'dsl': r'\E]2;\007',
# # return from status line
@ -407,7 +417,8 @@ def safe_print(*a, **k):
queryable_capabilities = numeric_capabilities.copy()
queryable_capabilities.update(string_capabilities)
extra = (bool_capabilities | numeric_capabilities.keys() | string_capabilities.keys()) - set(termcap_aliases.values())
if extra:
no_termcap_for = frozenset('Su Tc setrgbf setrgbb'.split())
if extra - no_termcap_for:
raise Exception('Termcap aliases not complete, missing: {}'.format(extra))
del extra

Binary file not shown.

View File

@ -1,4 +1,6 @@
xterm-kitty|KovIdTTY,
Su,
Tc,
am,
ccc,
hs,
@ -109,6 +111,8 @@ xterm-kitty|KovIdTTY,
sc=\E7,
setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
setrgbb=\E[48:2:%p1%d:%p2%d:%p3%dm,
setrgbf=\E[38:2:%p1%d:%p2%d:%p3%dm,
sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
sgr0=\E(B\E[m,
sitm=\E[3m,

Binary file not shown.