-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
"vintage" cursor shape + blinking with an escape sequence? #7382
Comments
@DHowett had a horrible idea in chat
which is actually an amazing idea IMO. We don't currently support subparams in sequences, but we're not too far away from that. I'm gonna summon @j4james to sanity check that using these sequences like this don't have an existing conflict. We might need to pick something silly like |
I would generally not encourage the use of sub parameters, because they're non-standard, and tend to break parsers in unpredictable ways. If you were an app developer that wanted to use this option, you'd then have to detect the terminal type to determine whether it was safe to send the sequence or not. So my preference would probably be to invent a completely new sequence for the size, if you really think you need it - something that would generally be treated as a no-op by terminals that don't support it (you can't always guarantee that, but the idea is to minimize the damage you're doing). I should also add that I thought someone already had a sequence for this. I had a brief look yesterday when the issue was first raised and didn't find anything, but it's probably worth doing a bit more research before reinventing something that may already exist. |
I just wanted to get back to my default (blinking "vintage"). In '\e[N q', N = 1/2 gives blink/non-blink block cursor, N = 3/4 the same for underscore, N = 5/6 the same for vertical bar. Since n = 8 gives the "vintage" size and shape, non-blinking, it seems reasonable that 7 give blinking "vintage" (it doesn't). I don't know what your restrictions are. Returning to the default should be straightforward (maybe even '\e[0 q' which now duplicates '\e[1 q'). Where can I find the handling of control sequences in the code? |
Just to be clear, we don't technically support parameter 8 as "vintage". Every number that isn't a recognised parameter just ends up as that by default. Personally I think that's a bug - if it's a not a supported parameter we should be ignoring it. If we want to use 7/8 as blinking and non-blinking vintage then those should be explicitly supported parameters. |
Yes, I figured parameters greater than 6 weren't supported. If unknown parameters are not ignored, and are going to lead to the default, it should respect whether the default is blinking or not (or at least preserve the current blink state). As for supported parameters, "vintage" (blinking/non-blinking) really should be among them. |
We didn't invent this sequence - it's just a standard that we are a following. Parameters 0 to 4 were originally defined by DEC, and 5 and 6 were later added by XTerm, and have since become a de facto standard. "Vintage" isn't a style that anyone else supports, so that would require a proprietary extension, which is not something that we want to rush into. |
You have (I guess) respected the "de facto standard". What's the problem with augmenting it? [I'm serious.] I wonder if XTerm agonized over adding 5 and 6? |
We have a specific resistance to extending any existing protocols like this. We'd much rather entirely invent our own sequence to use, that isn't even sorta used by anyone else, rather than extend an existing one. I agree with @j4james's assessment - using |
FWIW, I found the escape sequence I was thinking of. It's a private CSI that was used by SCO Unixware:
Not exactly what we want, because I think we can only set the height rather than the scanline range (at least in conhost). Also there's the question of how many scanlines there are in a character (you assumedly wouldn't want it to depend on font size). That said, it's worth noting that Kermit implemented this (when in "ANSI" mode) by calculating the requested height (i.e.
Assumedly this sequence would also function as a proxy for selecting the "vintage" cursor. And choosing whether the cursor should be blinking or not is already covered by the existing cursor blink mode (private mode 12). I'm not sure about this, but it's at least something to consider. |
As I mentioned at https://unix.stackexchange.com/a/597558/5132 , I've extended this to support 4 more shapes, myself. They are an outline box, a star, underline+overline, and a reversed "L" shape, inspired by some literature on real terminals. So if you do ever extend DECSCUSR, I'd appreciate it if we were compatible. |
Thanks for the info - that's useful to know. We do have an "Empty Box" cursor style, which sounds the same as your "outline box", so that's something I think we could easily support if we were going to extend DECSCUSR. Am I right in assuming that 7 and 8 are the blinking and non-blinking versions of the outline box in your implementation? |
This PR is about the behavior of DECSCUSR. This PR changes the meaning of DECSCUSR 0 to restore the cursor style back to user default. This differs from what VT spec says but it’s used in popular terminal emulators like iTerm2 and VTE-based ones. See #1604. Another change is that for parameter greater than 6, DECSCUSR should be ignored, instead of restoring the cursor to legacy. This PR fixes it. See #7382. Fixes #1604.
What about these? (from https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences) They work in the Windows console. |
And, after settings are reloaded, the cursor shape is restored but the blink state is not restored. This might be related to #7571 |
Maybe there should be a "cursorBlink" (true/false) profile setting? |
Moving to 2.0 b/c of #8560 |
From #16785:
|
I've been meaning to comment here that there's another escape sequence we could potentially use for this: The only negative is that it's not really an appropriate escape sequence, because But it's at least something to consider if nobody has any better ideas. |
Hello! There are a lot of different issues I found online about vim in PowerShell 7 used in the Windows Terminal not displaying the correct cursor shape for insert mode, command mode, visual mode, replace mode et cetera. From what I could find, this thread is supposed to be the original one, I hope I am posting in the right place. It's working by adding set termguicolors before the escape sequences in the C:\Program Files (x86)\Vim _vimrc file. set termguicolors let &t_SI = "\e[4 q" Without set termguicolors or set t_Co=256 it doesn't work, but with one of them it does. Hopefully the people in this thread that still has problems can solve them with this. found it here: vim/vim#11028 |
I am also using the following:
and it works reasonably well, but:
The issues are present only in WT. In Windows bundled powershell/wsl terminals the issue is not present. I have the same setting for iTerm2 on MacOs and the described issues are not present. |
In Windows Terminal, can I get the "vintage" cursor (~30% blinking horizontal bar) with an escape sequence?
Both of these (below) give a non-blinking cursor of the desired size. Other similar pairs suggest that 7 should be blinking?
ESC[7 q
ESC[8 q
The text was updated successfully, but these errors were encountered: