support wdq colors in microsoft terminal #4801

Closed
opened 2026-01-30 23:56:54 +00:00 by claunia · 4 comments
Owner

Originally created by @VladimirAlexiev on GitHub (Nov 4, 2019).

Environment

Microsoft Windows Version 10.0.18362.418, whose cmd includes the new Terminal tab/options (eg see https://devblogs.microsoft.com/commandline/new-experimental-console-features/)

Any other software?

Steps to reproduce

wdq help

Expected behavior

Should show modestly colored output:

image

Actual behavior

Shows escape sequences:

wdq [ MODE ] [ OPTIONS ] [ REQUEST | < REQUEST_FILE ]
Usage:
  Access Wikidata Query Service <https://query.wikidata.org/> via command                                      
  line to perform SPARQL queries ("query" mode), lookup entities ("lookup"),
  or search items and properties ("search" or "psearch"):                                                                                                                                                                     ...
  See the manual for details or get help via "wdq help":                  

Through file

If I save the output to a file (-C explicitly enables color mode) then type or cat the file to the microsoft terminal, the color shows ok:

wdq -C help > wdq-help.txt 
type wdq-help.txt 
cat wdq-help.txt 

The saved file: wdq-help.txt

So I thought the problem may be related to some startup magic? The file starts like this:

>head /cygdrive/c/Strawberry/perl/site/bin/wdq
#!/usr/bin/env perl
use v5.14;

Starting perl explicitly makes no difference:

perl -S wdq help
Originally created by @VladimirAlexiev on GitHub (Nov 4, 2019). # Environment Microsoft Windows Version 10.0.18362.418, whose `cmd` includes the new `Terminal` tab/options (eg see https://devblogs.microsoft.com/commandline/new-experimental-console-features/) Any other software? - Clink v0.4.9 [git:2fd2c2] Copyright (c) 2012-2016 Martin Ridgers http://mridgers.github.io/clink - https://github.com/nichtich/wdq 0.4.4 (/cygdrive/c/Strawberry/perl/site/bin/wdq) - perl v5.28.0 - cygwin # Steps to reproduce ``` wdq help ``` # Expected behavior Should show modestly colored output: ![image](https://user-images.githubusercontent.com/536250/68113597-d5947200-fefc-11e9-9c72-de143016d5df.png) # Actual behavior Shows escape sequences: ``` wdq [ MODE ] [ OPTIONS ] [ REQUEST | < REQUEST_FILE ] Usage: Access Wikidata Query Service <https://query.wikidata.org/> via command line to perform SPARQL queries ("query" mode), lookup entities ("lookup"), or search items and properties ("search" or "psearch"): ... See the manual for details or get help via "wdq help": ``` # Through file If I save the output to a file (`-C` explicitly enables color mode) then `type` or `cat` the file to the microsoft terminal, the color shows ok: ``` wdq -C help > wdq-help.txt type wdq-help.txt cat wdq-help.txt ``` The saved file: [wdq-help.txt](https://github.com/microsoft/terminal/files/3803499/wdq-help.txt) So I thought the problem may be related to some startup magic? The file starts like this: ``` >head /cygdrive/c/Strawberry/perl/site/bin/wdq #!/usr/bin/env perl use v5.14; ``` Starting perl explicitly makes no difference: ``` perl -S wdq help ```
claunia added the Issue-QuestionNeeds-TriageArea-VTNeeds-Tag-FixNeeds-Attention labels 2026-01-30 23:56:54 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Nov 4, 2019):

So admittedly, I don't know a ton about how exactly clink/cygwin works. What I can say is that in order for escape sequences to work in the Windows Console (conhost.exe, the vintage terminal on Windows), applications need to explicitly call SetConsoleMode with ENABLE_VIRTUAL_TERMINAL_PROCESSING. So perhaps something in the stack here isn't calling that? @VladimirAlexiev Are there any other apps in your setup that should be displaying colors but aren't?

For the record, installing wdq in WSL does correctly display the colors:
image

This is because WSL itself is setting the console into the correct mode for all child processes it launches.

@zadjii-msft commented on GitHub (Nov 4, 2019): So admittedly, I don't know a ton about how exactly clink/cygwin works. What I can say is that in order for escape sequences to work in the Windows Console (conhost.exe, the vintage terminal on Windows), applications need to explicitly call [`SetConsoleMode`](https://docs.microsoft.com/en-us/windows/console/setconsolemode) with `ENABLE_VIRTUAL_TERMINAL_PROCESSING`. So perhaps something in the stack here isn't calling that? @VladimirAlexiev Are there any other apps in your setup that _should_ be displaying colors but aren't? For the record, installing `wdq` in WSL does correctly display the colors: ![image](https://user-images.githubusercontent.com/18356694/68127373-6195a200-fedb-11e9-8626-22ab39da1386.png) This is because WSL itself is setting the console into the correct mode for all child processes it launches.
Author
Owner

@ghost commented on GitHub (Nov 8, 2019):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Nov 8, 2019): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@VladimirAlexiev commented on GitHub (Nov 13, 2019):

@zadjii-msft thanks for looking into that! What is WSL and how do I install wdq into it?

@VladimirAlexiev commented on GitHub (Nov 13, 2019): @zadjii-msft thanks for looking into that! What is WSL and how do I install wdq into it?
Author
Owner

@zadjii-msft commented on GitHub (Nov 13, 2019):

WSL is the Windows Subsystem for Linux.

You can find instructions on how to install it here.

Once you have your distro of choice, you can install wdq however you normally would on linux. IIRC this was the script I used:

wget https://github.com/nichtich/wdq/raw/master/script/wdq
chmod +x wdq
@zadjii-msft commented on GitHub (Nov 13, 2019): WSL is the Windows Subsystem for Linux. You can find instructions on how to install it [here](https://docs.microsoft.com/en-us/windows/wsl/install-win10). Once you have your distro of choice, you can install `wdq` however you normally would on linux. IIRC [this was the script I used](https://github.com/nichtich/wdq#prebuild-packages): ```sh wget https://github.com/nichtich/wdq/raw/master/script/wdq chmod +x wdq ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4801