Terminal: Font settings not working for WSL apps that draw over the entire screen

Created on 15 May 2018  路  21Comments  路  Source: microsoft/terminal

  • Your Windows build number: (Type ver at a Windows Command Prompt)

Microsoft Windows [Version 10.0.17134.48]

  • What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)

    • Launch WSL console
    • Set default font to something other than the default font (e.g. on a system with MS Gothic as the default
      font, choose Source Code Pro instead in Default Values), then reopen the window;
    • Install and launch apps that redraws the entire screen (e.g. mosh, tmux, vim, etc.)
    • Exit from the app

One should not experience font change in the process

  • What's wrong / what should be happening instead:

The font gets reverted to the default font (in my case MS Gothic) as soon as tmux gets started, and sometimes the font reverts back to the font I selected when it exits (either finishes executing and exits or detaches), sometimes it doesn't. Setting the font in "Properties" does change the font, but the setting doesn't get preserved.

On exit, the font gets reverted to the default one shortly, and then the window closes.

image
image

Area-Fonts Issue-Bug Needs-Repro Product-Conhost Resolution-Answered

Most helpful comment

Not sure if this bug has been fixed already, anyway, in my case, just changing the code page of command prompt works :

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlNlsCodePage]
"ACP"="1252"
"MACCP"="10000"
"OEMCP"="437"

All 21 comments

same with you

I have the same issue.

Also the window size changes, not just the font.
e.g. when I am in shell, the height x width might be, say, 40 x 150. But when I go into an application (vim, man pages...etc) that gets displayed over the entire terminal window, the Window's size gets changed to another size (I suspect it goes back to default Cmd window size). The font also gets changed back to the default font for the Cmd window.

It feels like as if when I go into an application from the Shell, settings such as size and font gets changed back to default, however the color settings stays (thank goodness)

having the same issue.

workaround is changing TERM=xterm-256color to TERM=xterm-color in registry DefaultEnvironment

Same here. Microsoft Windows [Version 10.0.17134.112]. The font also changes when the window is loading or quitting. Both setting the default values and properties still cannot work.

Same here. By the way, is this issue about WSL? or just an issue that I can solve with the application setting?

Same here on Windows [Version 10.0.17134.345].
I changed default font to Ubuntu Mono but it gets reverted to its original setting when I run applications like vim or man.

Filed a bug internally to investigate. I think I know why this might be happening, for whatever reason the alt-buffer used by tmux and vim (et al) either isn't getting the font setting or the codepage setting. My guess is it's not getting the codepage, and then it's re-calculating the font it should use, and defaulting to the default codepage instead of the utf-8 codepage.

not sure if it's the same problem with my WSL. I've configured my console default font successfully, but i can't change my vim font setting, no change even with :set guifont=Consolas h12 inside vim.

@windtoostrong

If you're using vim in the console, guifont doesn't do anything (and cannot do anything.)
If you're using gvim/xvim, you need to say Consolas:h12 (: instead of .)

It's vim in the console, it just go with my console configuration. Don't know why Consolas doesn't seem to work for me. I switched to use Microsoft Yahei Mono, my vim and console now shares the same font and works fine.

I also have this problem. I found a workaround by using Inziu IosevkaCC SC from http://typeof.net/Iosevka/.

I've tried reproing this internally for a bit now and I can't get this behavior to repro. I've tried on a VM with MS Gothic as the default font, and I can't get the alt buffer to revert back to the default font in any scenario.

It's entirely possible that this was fixed in RS5 (the November 2018 Update). There was also a decent amount of code delta in that area since RS5, which could have also mitigated the issue. Without being able to repro it, I won't be able to track the fix down.

If someone can confirm that this is still occurring on a recent Insider's build, I'll reopen the investigation, but until then I'm marking it as not repro.

I also encountered a problem with resetting fonts. It is recommended to use Xshell with ssh to temporarily replace the default console.

It works!

Like @zadjii-msft said, the problem is Windows can not change the cmd.exe code page permanently, WSL/Bash use utf8 code page which different from cmd.exe usually, so we need to find a font that both supports utf8 and your current default code page of cmd.exe.

The font that @lnyng pointed out works for me.

Not sure if this bug has been fixed already, anyway, in my case, just changing the code page of command prompt works :

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlNlsCodePage]
"ACP"="1252"
"MACCP"="10000"
"OEMCP"="437"

Not sure if this bug has been fixed already, anyway, in my case, just changing the code page of command prompt works :

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlNlsCodePage]
"ACP"="1252"
"MACCP"="10000"
"OEMCP"="437"

that works for my vim, thanks!

Looks like this solved itself. Resolving.

The bug reproduce in 1903 clean install.
The default font is MingLiU. Then I change it to consolas.
Open htop or vim, change back to consolas.

SO I use wsltty as a workaround.

use regedit and add CodePage=65001 in HKCUConsolemd5-aabaca78aaef9a08c0748aa3664499dcC:.....Debian....exe solve my problem.
after this launch full screen program won't reset font again.

Not sure if this bug has been fixed already, anyway, in my case, just changing the code page of command prompt works :

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlNlsCodePage]
"ACP"="1252"
"MACCP"="10000"
"OEMCP"="437"

This worked for my Vim and Tmux after a reboot! Thx!

having the same issue.

workaround is changing TERM=xterm-256color to TERM=xterm-color in registry DefaultEnvironment

This fixes my problem. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TayYuanGeng picture TayYuanGeng  路  3Comments

alabuzhev picture alabuzhev  路  3Comments

miniksa picture miniksa  路  3Comments

NickITGuy picture NickITGuy  路  3Comments

carlos-zamora picture carlos-zamora  路  3Comments