-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Please finish support for OSC 4 and friends #317
Comments
Okay, this is a great writeup. However, there's a LOT of work to be done here - more than I can likely justify getting into the next (19H1) release of Windows. That being said, I have filed a pile of internal tasks on me to make sure these scenarios are all covered. As you called out, #313 is fortunately on my tasklist for this month, so hopefully that one should be out soontm. This is deliverable MSFT:19859141 |
For what it's worth, @zadjii-msft I would say OSC 110 and 111 (if implemented such that they return it to white on black) would be way more useful than any of the rest of it. Honestly, the way it is now (or with #313 fixed) it's not very useful. Without knowing/controlling which color is the actual (default) background and foreground, setting the color palette is almost pointless -- did you see that screenshot on #81 with the pink background and bright yellow text? |
Ah, so I'd say the main problem you're having is that powershell has hard-coded it's default colors to be yellow on magenta, then re-defined what yellow and magenta are (to a light grey and Powershell Blue). We've tried to get them to change this in the past, but it's never happened. Currently, o of the big differences between conhost and other terminals is that we don't support the notion of a default color that's not a part of the color table. I'd have to investigate, but presumably, using those OSC's to reset the "default color" would revert the default color to whatever conhost had when it was launched, but it wouldn't change which indices were set as the defaults. Also stay tuned in this area, I think we'll have something bubbling up the source tree that I can't really talk about quite yet :) |
There is one thing though I'd be careful about - it's that (CSI) control sequences may have multiple parameters, but to be strictly compatible there's a limit of sixteen parameters as anything beyond that is silently ignored. I'm not sure if the same limits apply to OSC sequences, but it's likely. But if tmux/xterm/screen are doing it, I guess it's probably okay? |
I don't think that applies @oising. CSI parameters are also limited to be numbers, because the thing is building a buffer of parameters to pass to the command. For OSC, there's no buffer: OSC strings have to be terminated by ST, CAN, SUB or ESC -- any other characters are supposedly just "passed" from the control string to the handler as they arrive... @zadjii-msft I'll retract what I said earlier, if that's how it is. In that case, OSC 110 and 111 are not what I want. I obviously need OSC 10 and 11 instead. 😬 I guess that really, one way or another, I need to be able to force the background to a known value. I have been assuming that the windows console wouldn't suddenly learn how to have a different default bg/fg and would be limited to one of the 16 palette values ... I'm used to that by now. But I was thinking the defaults would be defaults in the global sense, or at least in the sense that's used in the window's menu... So yeah. Anyway. From my perspective, I don't really care if the background is black, blue, magenta -- but I do need know for certain which color index the background is. The goal is to avoid that awkward situation where I write text in the background color, when I thought I was writing highly visible pink or white on black ... And yes, the number one offender is the PowerShell blue background -- but people can (and do) change their defaults. I have had several co-workers with vision impairments and they all tend to force their consoles to black on a white background. |
This probably belongs here as a reference for others finding this thread: https://blogs.msdn.microsoft.com/commandline/2018/12/10/new-experimental-console-features/ |
Very exciting -- and makes OSC 10 and 11 even more critical 🤔 is there even a way to set those without the dialog right now? 🤨 And in particular querying. How could an application update it's own knowledge of |
Those aren't modifiable or queryable at the moment using VT. It's a pretty early experimental feature at the moment, so I'll make sure to bump up the priority of changing and querying those values, but that will all probably fall under the scope of the aforementioned deliverable. |
Any progress here, @zadjii-msft ? |
OK, since we have source ... I'm going to try doing this myself, but I need a little help. Over on Jaykul/SettableDefaultColors I've got a working version of OSC 10 and 11 for conhost, but although they clearly have some effect, I feel like they're not working properly in Terminal, and I'm not sure what I missed. Can anyone either:
|
You have to set to Native only in the properties for debugging: https://github.com/microsoft/Terminal/blob/master/doc/Debugging.md |
@Jaykul great work with that - that's pretty much everything that I'd think you'd need. If it doesn't work for the terminal, I'd presume that for some reason, the color change isn't making it's way through conpty. I'd think that the code you correctly grabbed to return false in conpty mode (near this line) should make sure the sequence is re-emitted through conpty. I'd set a breakpoint in |
@zadjii-msft in a related note ... in Is there a reason it needs to be like that? It prevents supporting arrays like xterm does: multiple sets of semicolon-delimited It also complicates querying (when the value is |
There's definitely no reason that the parser needs to behave like that. You're right that it probably shouldn't, I just haven't gotten the time to go back and update that yet :P There definitely is a way to respond back to the caller from the adapter. I can't remember the name of the call off the top of my head, something like Device Status Request or something, where we reply with the cursor position. |
I figured out why the terminal wasn't working. In order to change the background color of the Windows Terminal, you have to reset all the Acrylic stuff. I've got it working! |
Hey hey, this is now available in the inbox windows console as of insider build 18932! Congrats! |
I was really happy to see support for OSC 4 to set the 16 palette colors (and I recently helped a friend add it to the docs, the way it is now) ...
However, I have some problems. I'm hoping you can address them all as one request, but I'm happy to split them out. First, as background the xterm control sequences docs. Obviously these are not sacred, but they do represent a sort-of standard in that other terminals and tmux have implemented these same sequences the same way...
index;spec
without having to repeat theESC]4;
part, so you can do:ESC]4;0;rgb:00/00/00;1;rgb:00/00/70;...\\
and list out the whole set of colors as one giant escape sequence.ESC]4;5;?\\
and parsing the outputAdditionally ... without support for OSC 10 and 11 I cannot change the default foreground and background colors, so there's no way to fix (even temporarily) the fact that PowerShell is using 5 as it's default background color. NOTE that these should also support querying with a "?"
AND EVEN WORSE ...
We really also need support for OSC 104 (and 110 and 111) which would reset the colors changed by OSC 4, 10, and 11 to their defaults. Note that if done right, they support resetting individual colors, but as a first draft, I'd settle for the parameterless reset of the entire table -- and for my own purposes, if you implement 110 and 111 as meaning force WHITE text on a BLACK background, without implementing 10 and 11, I wouldn't cry 😉
The text was updated successfully, but these errors were encountered: