From 2ab6f57159ac4b406148208e2972c6784f502f78 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 8 Feb 2018 10:26:13 +0530 Subject: [PATCH] Add non-standard terminfo capabilities Advertises support for truecolor and styled underlines. The truecolor properties are used by at least tmux and neovim. --- build-terminfo | 2 +- kitty/terminfo.py | 17 ++++++++++++++--- terminfo/78/xterm-kitty | Bin 1776 -> 1874 bytes terminfo/kitty.terminfo | 4 ++++ terminfo/x/xterm-kitty | Bin 1776 -> 1874 bytes 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/build-terminfo b/build-terminfo index db13fae8c..054aa4bb6 100755 --- a/build-terminfo +++ b/build-terminfo @@ -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') diff --git a/kitty/terminfo.py b/kitty/terminfo.py index 1d611d964..bb843c7f5 100644 --- a/kitty/terminfo.py +++ b/kitty/terminfo.py @@ -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 diff --git a/terminfo/78/xterm-kitty b/terminfo/78/xterm-kitty index 75c3f2bba1484228226cfcc313c689a635bf3929..e2ff4ecb26abfcf5b41e80ba8550d38b1546aca9 100644 GIT binary patch delta 106 zcmeysdx>wu2eu?81_lNu1~vvS21Z5(1}Pwq8OY;fkd8L7urjhzEihC~0g^^w(pWVm b7bs(lLngSCAtafhIJKlGJt+xFr!fEkb%hvn delta 7 Ocmcb__knlA2Q~l>^8wu2eu?81_lNu1~vvS21Z5(1}Pwq8OY;fkd8L7urjhzEihC~0g^^w(pWVm b7bs(lLngSCAtafhIJKlGJt+xFr!fEkb%hvn delta 7 Ocmcb__knlA2Q~l>^8