Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim colors rendered incorrectly with TERM=xterm-kitty #231

Closed
rnevius opened this issue May 15, 2020 · 13 comments
Closed

Vim colors rendered incorrectly with TERM=xterm-kitty #231

rnevius opened this issue May 15, 2020 · 13 comments

Comments

@rnevius
Copy link

rnevius commented May 15, 2020

As above. Colors render correctly when manually setting TERM=xterm-256color, but incorrectly with TERM=xterm-kitty.

Kitty is a popular terminal emulator.

@rnevius rnevius closed this as completed May 15, 2020
@rnevius rnevius reopened this May 15, 2020
@sbeckeriv
Copy link

@rnevius how did you get it to run at all on kitty with TERM=xterm-kitty? I came here to open an issue. using TERM=xterm-256color does allow me to run it in kitty. I didnt test any colours yet.

kitty 0.17
asciinema 2.0.2

i get

✦ ❯ asciinema rec
asciinema: recording asciicast to /tmp/tmp0w9854hp-ascii.cast
asciinema: press <ctrl-d> or type "exit" when you're done
tput: unknown terminal "xterm-kitty"
Traceback (most recent call last):
  File "/usr/bin/asciinema", line 11, in <module>
    load_entry_point('asciinema==2.0.2', 'console_scripts', 'asciinema')()
  File "/usr/lib/python3/dist-packages/asciinema/__main__.py", line 131, in main
    code = command.execute()
  File "/usr/lib/python3/dist-packages/asciinema/commands/record.py", line 69, in execute
    asciinema.record_asciicast(
  File "/usr/lib/python3/dist-packages/asciinema/__init__.py", line 33, in record_asciicast
    w, h = term.get_size()
  File "/usr/lib/python3/dist-packages/asciinema/term.py", line 35, in get_size
    int(subprocess.check_output(['tput', 'cols'])),
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['tput', 'cols']' returned non-zero exit status 3.

@rnevius
Copy link
Author

rnevius commented Jun 5, 2020

@sbeckeriv Have you set up terminfo for Kitty? What is the output of echo $TERMINFO?

@sbeckeriv
Copy link

@rnevius I have not! it is blank. I will look in to that. Thanks.

@ku1ik
Copy link
Contributor

ku1ik commented Dec 11, 2021

asciinema 2.1 removed dependency on tput (ncurses) which should solve the above crash.

@ku1ik
Copy link
Contributor

ku1ik commented Feb 20, 2022

Are you able to show the screenshots of the correct and incorrect vim colors you observe when recording with asciinema?

@ku1ik ku1ik closed this as completed Apr 25, 2023
@EgZvor
Copy link

EgZvor commented Apr 26, 2023

Here's an example cast with wrong colors in Vim

https://asciinema.org/a/580734

@EgZvor
Copy link

EgZvor commented Apr 26, 2023

@sickill please, take a look at the above cast

@ku1ik
Copy link
Contributor

ku1ik commented Apr 26, 2023

I closed because of no response for over a year.

But yeah, your example @EgZvor shows something is off indeed. Thanks.

@ku1ik ku1ik reopened this Apr 26, 2023
@ku1ik ku1ik transferred this issue from asciinema/asciinema Apr 26, 2023
@EgZvor
Copy link

EgZvor commented Apr 27, 2023

You might want to check out this thread vim/vim#11716 and this advice from Kovid https://sw.kovidgoyal.net/kitty/faq/#using-a-color-theme-with-a-background-color-does-not-work-well-in-vim (which I applied and is what breaks the highlighting in asciinema).

@ku1ik
Copy link
Contributor

ku1ik commented Apr 27, 2023

Thanks for the context. This actually explains a lot. I suspect the use of non-standard : instead of ; in color related escape sequences.

@kovidgoyal
Copy link

Thanks for the context. This actually explains a lot. I suspect the use of non-standard : instead of ; in color related escape sequences.

Note that colon is standard, from ECMA-48. semi-colon is non-standard but more common, IIRC konsole first started erroneously using semi-colon and it spread from there. Most modern terminal emulators support both forms. You should too.

To be didactic, the reason colon is used is because it encodes sub-parts of a single specification. SGR escape codes can actually contain multiple semi-colon separated parts (though this is rarely used in practice). In the presence of multiple parts separating sub-parts with semi-colons is ambiguous. Therefore, colons should always be used for sub-parts.

@ku1ik
Copy link
Contributor

ku1ik commented Apr 27, 2023

Yeah, that makes a lot of sense. Thanks.

We'll need to implement support for it in https://github.com/asciinema/avt

@ku1ik
Copy link
Contributor

ku1ik commented Jun 15, 2024

This has been fixed in 3.8.0 - https://github.com/asciinema/asciinema-player/releases/tag/v3.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants