[vim/vim] `t_Cs` set to xterm cursor color escape sequence (#3480)

72 views
Skip to first unread message

Josh Klodnicki

unread,
Sep 24, 2018, 1:04:36 PM9/24/18
to vim/vim, Subscribed

't_Cs' (undercurl mode start) is somehow getting set to the xterm cursor color escape sequence, though nothing is assigning it. It is neither in the terminfo entry, nor (as far as I can tell) the built-in termcaps. It is definitely not getting set in a script. (Yes, even with plugins disabled via vim -N -u NONE.) So where does it come from?

The issue causes problems with colorschemes using cterm=undercurl, which are becoming more common since kitty added support for the feature. It can be fixed by overriding the setting (:set t_Cs=), but that should not be necessary.

How to Reproduce:

I was able to reproduce the issue with several xterm-compatible terminals on Debian and Cygwin, using Vim v8.0.1376 and v8.1.429.

TERM=xterm vim -N -u NONE
:set t_Cs?
    -> t_Cs=^[]12;%p1%s^G

See also: #2424, #3471


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

Daniel Hahler

unread,
Sep 25, 2018, 2:18:06 PM9/25/18
to vim/vim, Subscribed

Figured it out: #3471 (comment)

Isn't this a duplicate of #3471?

Daniel Hahler

unread,
Sep 25, 2018, 2:30:04 PM9/25/18
to vim/vim, Subscribed

since kitty added support for the feature

For reference: neovim/neovim#7479 (comment)

It supports detection via Su (https://sw.kovidgoyal.net/kitty/protocol-extensions.html).

Josh Klodnicki

unread,
Sep 26, 2018, 10:11:06 AM9/26/18
to vim/vim, Subscribed

Isn't this a duplicate of #3471?

I don't get a pink cursor (in mintty), so I thought your issue didn't really apply to me. Your issue is definitely a direct result of this one though.

I just wanted to be more directly to the point.

Daniel Hahler

unread,
Sep 26, 2018, 10:16:45 AM9/26/18
to vim/vim, Subscribed

Ok.

What is infocmp -x for you?

Josh Klodnicki

unread,
Sep 26, 2018, 10:49:10 AM9/26/18
to vim/vim, Subscribed

Cs is indeed in terminfo, as an extension. Thanks for the heads up on using -x.

$ TERM=xterm infocmp -1x | grep Cs
        Cs=\E]12;%p1%s\007,

See #3471 (comment)

Bram Moolenaar

unread,
Sep 26, 2018, 12:24:31 PM9/26/18
to vim/vim, Subscribed

> `Cs` is indeed in terminfo, as an extension. Thanks for the heads up on using `-x`.
>
> ```

> $ TERM=xterm infocmp -1x | grep Cs
> Cs=\E]12;%p1%s\007,
> ```
>
> See https://github.com/vim/vim/issues/3471#issuecomment-424739789

So we need to stop requesting Cs and Ce for t_Cs and t_Ce.
The codes are apparently used for the cursor color.
We could add t_cS and t_cE for those. A bit confusing, but it avoids
backwards compatibility problems

--
hundred-and-one symptoms of being an internet addict:
105. When someone asks you for your address, you tell them your URL.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Josh Klodnicki

unread,
Sep 26, 2018, 1:57:06 PM9/26/18
to vim/vim, Subscribed

The codes are apparently used for the cursor color.

Cs and Cr are used for set and reset cursor color, respectively. Ce is not used. (#3471 (comment))

Not that it makes any difference.

We could add t_cS and t_cE for those. A bit confusing, but it avoids backwards compatibility problems

Personally, I would prefer Us and Ue, to emphasize "alternate underline".

yamahavino

unread,
Oct 20, 2024, 12:56:28 PM10/20/24
to vim/vim, Subscribed

Shouldn't t_Cs be using the Smulx entry from terminfo? I use alacritty as my terminal emulator:

$ TERM=alacritty infocmp -1 -x | grep Smulx
	Smulx=\E[4:%p1%dm,

Doing:

$ echo -e '\e[4:3mThis has an undercurl.'

behaves as expected.

If I do $ vim -u NONE -N and then set t_Cs?, I get what @joshklod reported above, which is what terminfo has set for the Cs capability. But when I examine the output of set termcap?, t_Cs is not listed. (Interestingly, t_Ce is listed and is empty.)

It looks to me like several unwanted things are going on:

  1. t_Cs isn't getting set to the undercurl command reported by terminfo (i.e. the Smulx setting) at all, instead using the cursor colour command Cs. (Confusion because of name similarity?)
  2. Vim isn't reporting the value used for t_Cs in the output of set termcap?.

(As an aside, like in #2424, for me Vim isn't falling back to underline when :hi SpellBad cterm=undercurl is set. Maybe 45a0000 was inadvertently reverted somehow?)

All this misbehaviour goes away if I do :set t_Cs=^[[4:3m -- t_Cs is reported correctly in all contexts, and mis-spelled words have the undercurl applied.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/3480/2425117851@github.com>

Josh Klodnicki

unread,
Oct 21, 2024, 1:11:28 PM10/21/24
to vim/vim, Subscribed

Shouldn't t_Cs be using the Smulx entry from terminfo?

Maybe, but it's not a drop-in replacement, as Smulx requires an argument.

But when I examine the output of set termcap?, t_Cs is not listed.

Are you sure it's not listed below among the longer sequences?

(Interestingly, t_Ce is listed and is empty.)

Yes, that is expected because there is no terminfo entry for Ce. (infocmp -1x | grep Ce)

(As an aside, like in #2424, for me Vim isn't falling back to underline when :hi SpellBad cterm=undercurl is set. Maybe 45a0000 was inadvertently reverted somehow?)

Does fallback work after doing :set t_Cs=?


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/3480/2427283240@github.com>

yamahavino

unread,
Nov 13, 2024, 4:16:04 PM11/13/24
to vim/vim, Subscribed

But when I examine the output of set termcap?, t_Cs is not listed.

Are you sure it's not listed below among the longer sequences?

My mistake, it is indeed listed among the longer sequences, manifesting the problem:

t_Cs=^[]12;%p1%s^G

Does fallback work after doing :set t_Cs=?

It's not falling back to the underline, but is instead showing up with a different background colour, not an underline.

PS - Sorry for the delay in responding, I missed the notification that you had responded.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/3480/2474799567@github.com>

Reply all
Reply to author
Forward
0 new messages