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

Fixed: Implement colon separated CSI parameters #4154

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

fornwall
Copy link
Member

Colon separated escape sequences for setting colors

It seems that more and more terminal emulators and terminal programs supports colon (:) as well as semicolon (;) to specify colors:

red=255 green=100 blue=0 
printf "\x1b[38;2;${red};${green};${blue}m TRUECOLOR\n" # Semicolon separated, works in Termux
printf "\x1b[38:2:${red}:${green}:${blue}m TRUECOLOR\n" # Colon separated, implemented in this PR

See https://github.com/termstandard/colors?tab=readme-ov-file#truecolor-support-in-output-devices, where it can be seen that multiple terminal emulators also support using a colon as delimiter nowadays:

This is now implemented in Termux as well. Fixes termux/termux-packages#20655, escape sequence issues with vtm.

See alacritty/vte#22 for a discussion when this was implemented in alacritty/vte.

Colored and styled underlines parsing

We also here start to parse Colored and styled underlines as initially proposed by Kitty:

To set the underline style:

[4:0m # no underline
[4:1m # straight underline
[4:2m # double underline
[4:3m # curly underline
[4:4m # dotted underline
[4:5m # dashed underline
[4m # straight underline (for backwards compat)
[24m # no underline (for backwards compat)

To set the underline color (this is reserved and as far as I can tell not actually used for anything):

[58...m
This works exactly like the codes 38, 48 that are used to set foreground and background color respectively.

To reset the underline color (also previously reserved and unused):
[59m

In this initial step we currently don't support straight/double/curly/dotted/dashed nor colored underlines, but parse them and map them to normal underlines. Fixes termux/termux-packages#20620, escape sequences showing up at the start of neovim. Future follow up work is actually respecting them when rendering, which is (at least IMHO) a nice touch when using code editors with support for it such as neovim.

@fornwall fornwall force-pushed the colon-separated-csi-parameters branch 2 times, most recently from 98e98c0 to 9a8dcd0 Compare September 18, 2024 20:43
@fornwall fornwall force-pushed the colon-separated-csi-parameters branch 3 times, most recently from 9fe5fb9 to cf25329 Compare September 26, 2024 14:40
@fornwall fornwall force-pushed the colon-separated-csi-parameters branch from cf25329 to c5b655b Compare September 27, 2024 09:40
@fornwall fornwall merged commit 8be5333 into master Oct 2, 2024
4 checks passed
@fornwall fornwall deleted the colon-separated-csi-parameters branch October 2, 2024 15:27
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

Successfully merging this pull request may close these issues.

[Bug]: escape sequence issues with vtm [Bug]: Strange behavior of neovim after update
2 participants