Incomplete support of ConEmu's OSC 9;4 sequences #13645

Closed
opened 2026-01-31 03:48:16 +00:00 by claunia · 4 comments
Owner

Originally created by @chausner on GitHub (Apr 26, 2021).

#8055 implemented the ConEmu-specific VT sequence for displaying progress bars in the Windows task bar. According to https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC, the progress value number in the sequence is optional when st is set to 2 or 4 but Windows Terminal currently does not recognize these sequences. For example:

> python
print("\x1b]9;4;2;\x1b\\")

switches the progress state to "Error" in ConEmu but does not have any effect in Windows Terminal.

Even though it is not explicitly written in the documentation linked above, ConEmu also allows leaving out the progress value when pr is set to values other than 2 and 4. This makes sense since for clearing the progress with pr = 0 or switching to indeterminate state pr = 3, the progress value does not have any meaning anyway.

I suggest to adjust the implementation in Windows Terminal to properly recognize sequences where the pr value has been left out in order to be compatible with ConEmu. The expected behaviour in this case would be to just switch the progress state but leave the progress value at the previously set value.

/cc @DHowett

Originally created by @chausner on GitHub (Apr 26, 2021). #8055 implemented the ConEmu-specific VT sequence for displaying progress bars in the Windows task bar. According to https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC, the progress value number in the sequence is optional when `st` is set to 2 or 4 but Windows Terminal currently does not recognize these sequences. For example: ```python > python print("\x1b]9;4;2;\x1b\\") ``` switches the progress state to "Error" in ConEmu but does not have any effect in Windows Terminal. Even though it is not explicitly written in the documentation linked above, ConEmu also allows leaving out the progress value when `pr` is set to values other than 2 and 4. This makes sense since for clearing the progress with `pr = 0` or switching to indeterminate state `pr = 3`, the progress value does not have any meaning anyway. I suggest to adjust the implementation in Windows Terminal to properly recognize sequences where the `pr` value has been left out in order to be compatible with ConEmu. The expected behaviour in this case would be to just switch the progress state but leave the progress value at the previously set value. /cc @DHowett
Author
Owner

@j4james commented on GitHub (Apr 27, 2021):

Wow. This is way more complicated than I originally thought.

Default and missing parameter values map to 0 (I believe we already do this). But when the progress value is 0, that has special meaning for states 2 and 4. As far as I can make out, the rules are as follow:

  • If the state is 0, the current progress value should be set to 0, regardless of the given value.
  • If the state is 3, the current progress value should be left unchanged, regardless of the given value.
  • If the state is 1, the current progress value is updated with the given value, clamped 0 to 100.
  • If the state is 2 or 4, the current progress value is only updated with the given value if greater than 0. If 0, it inherits the existing value. If the existing value is 0, then it appears to be set to the minimum non-zero value.

Some examples:

  • 9;4;1;50 then 9;4;2 sets the progress value to 50
  • 9;4;0;50 then 9;4;2 sets the progress value to something like 10 (the minimum) not 50
  • 9;4;1;50 then 9;4;3;75 then 9;4;2 sets the progress value to 50 not 75
@j4james commented on GitHub (Apr 27, 2021): Wow. This is way more complicated than I originally thought. Default and missing parameter values map to 0 (I believe we already do this). But when the progress value is 0, that has special meaning for states 2 and 4. As far as I can make out, the rules are as follow: * If the state is 0, the current progress value should be set to 0, regardless of the given value. * If the state is 3, the current progress value should be left unchanged, regardless of the given value. * If the state is 1, the current progress value is updated with the given value, clamped 0 to 100. * If the state is 2 or 4, the current progress value is only updated with the given value if greater than 0. If 0, it inherits the existing value. If the existing value is 0, then it appears to be set to the minimum non-zero value. Some examples: * 9;4;1;50 then 9;4;2 sets the progress value to 50 * 9;4;0;50 then 9;4;2 sets the progress value to something like 10 (the minimum) not 50 * 9;4;1;50 then 9;4;3;75 then 9;4;2 sets the progress value to 50 not 75
Author
Owner

@j4james commented on GitHub (Apr 27, 2021):

Default and missing parameter values map to 0 (I believe we already do this).

Actually it looks like I'm wrong about this too. The OSC commands don't use the standard parameter parser, so this doesn't handle the cases where the semicolon is present but the parameter value isn't, e.g. 9;4;1 will be correctly interpreted as 9;4;1;0, but 9;4;1; (with a trailing semicolon) will fail.

@j4james commented on GitHub (Apr 27, 2021): > Default and missing parameter values map to 0 (I believe we already do this). Actually it looks like I'm wrong about this too. The OSC commands don't use the standard parameter parser, so this doesn't handle the cases where the semicolon is present but the parameter value isn't, e.g. `9;4;1` will be correctly interpreted as `9;4;1;0`, but `9;4;1;` (with a trailing semicolon) will fail.
Author
Owner

@zadjii-msft commented on GitHub (Apr 29, 2021):

@PankajBhojwani as an fyi

@zadjii-msft commented on GitHub (Apr 29, 2021): @PankajBhojwani as an fyi
Author
Owner

@ghost commented on GitHub (May 25, 2021):

:tada:This issue was addressed in #10024, which has now been successfully released as Windows Terminal Preview v1.9.1445.0.🎉

Handy links:

@ghost commented on GitHub (May 25, 2021): :tada:This issue was addressed in #10024, which has now been successfully released as `Windows Terminal Preview v1.9.1445.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.9.1445.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13645