terminal
terminal copied to clipboard
Windows 10 1809/19H1/20H1 breaks Powershell's console settings. Keeps opening with raster fonts.
Windows 10 1809 breaks Powershell's console settings. Powershell keeps opening with raster fonts. You can change the settings and see the result, but when you open the settings again (with or without closing the powershell inbetween) the font has reset to raster fonts in size 12.
Edit: Upgraded from 1803. German Locale.
https://aka.ms/AA37kk1
The same happens to me only when using the Consolas font. If I use anything else - Courier New, Lucida Console, etc. - the settings are retained.
@50Wliu I can confirm that behaviour. Consolas resets to raster font. Lucida Console stays Lucida Console.
I'm almost certain this has to do with the fact that the new version of PSReadline is using the UTF8 codepage for displaying it's prompt, and when it does that, the console tries to recalculate the font.
I thought we had some issues tracking this previously, but I can't seem to find them. @bitcrazed do you remember where they were? Or was it an internal mail thread with @lzybkr and @SteveL-MSFT?
Can someone provide an exact repro? Like what font are you setting to the shortcut. What font is it being set to?
-
Win-R
and runpowershell
. - It starts with raster font.
- Go into settings and set the font to Consolas. Click OK.
- Consolas is being applied.
- Close Powershell.
- Reopen powershell like before.
- Font is raster font again.
- Go into default settings and set the font to Consolas. Click OK.
- Close Powershell.
- Reopen powershell like before.
- Font is raster font again.
I don't think this was even Powershell's fault. I have a note sitting around here somewhere that one of the most recent .NET Frameworks (4.7something) suddenly decides to use 65001 as the default code page for all apps and when that flips back and forth with other tools and codepages as they start and exit, we recalculate the font.
I have a bug on me to try to make that less painful, but it's really the sudden flipping between codepages that is making this be a problem.
I can't reproduce this here. Both Windows PowerShell and Powershell both start up in the font I set.
@Borkason Have you tried concfg clean
https://github.com/lukesampson/concfg
@borakson - what locale is your Windows configured to use?
@bitcrazed I'm not @Borkason but since I'm experiencing this issue I'll answer as well.
My display language is Spanish (Spain), and so is my regional format. The language for programs that don't support Unicode is English (United States), and I have the beta checkbox selected for UTF-8 Unicode. (Hope that's what you're looking for...let me know if you were asking for something else)
@bitcrazed German. And I upgraded from 1803. Forgot to meantion that.
@doctordns which font?
@doctordns which font?
I use Lucida Console (18 pt). But I've tested others and they too work after a restart of Windows PowerShell.
The same happens to me only when using the Consolas font. If I use anything else - Courier New, Lucida Console, etc. - the settings are retained.
This was likely fixed by @lzybkr's recent work: https://github.com/lzybkr/PSReadLine/issues/542
@Borkason & @doctordns - can you please confirm and close if fixed?
Thanks.
@bitcrazed it looks like the issue you're referencing was fixed back in 2017 and as far as I can tell is included in the version of PSReadLine that 1809 ships with. Additionally, this issue is still occuring for me as of Windows Insiders build 18277.
@bitcrazed That's one year older then the 1809 release. I wouldn't call that "recent".
And for me nothing changed. I'm on Windows 10 build 17763.107
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.17763.1
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
But as @50Wliu already sayd, it's not even fixed in the current preview.
Here is a link to the Feedback: https://aka.ms/AA37kk1
@bitcrazed linked to the issue that caused the problem.
The fix is in this PR: https://github.com/lzybkr/PSReadLine/pull/771
Fair enough. Is it known with what build the fix will ship?
I'll try to release another beta to the PowerShell Gallery before the end of the year, but I don't know about Windows (I don't work on Windows).
@SteveL-MSFT owns the bits that ship in Windows, so maybe he can comment.
Name Value
PSVersion 5.1.17763.134 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.134 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
same here...ready to re-install windows, REALLY painful!
This problem seems links to fonts. I got the problem in Powershell with windows(cmd and Powershell core don't have this problem) when I set the font as 'Console', but when I change the font as 'Sarasa Mono SC', all work perfectly. I use 'Sarasa Mono SC' to show UTF-8 character, Windows 10 doesn't have a default font can show enough UTF-8 characters.
Same here. Both my Surface & desktop PC.
Strangely I think I am experiencing this same issue but from a different way. Whenever a subprocess is opened to run powershell.exe, the console font changes to raster from Consolas.
Example 1: I have vim running (WSL) and it runs a powershell sub command to get the system clipboard. Every time I run that command, it resets the console font to raster fonts.
Example 2: I have a shell script that runs powershell as a subprocess to get the system nameservers. It causes the same thing to happen to the console, a switch to raster fonts. Nothing is output to the console. Everything happens in the subprocess.
The really strange part is that if I run powershell manually from the console (WSL), then it's fine and the font does not change.
@bitcrazed, @SteveL-MSFT, @lzybkr: I have a good minimal repro. This started happening right after I upgraded the machine to Windows 1809. I had the font and console CP set before, as below, to Consolas and 65001 respectively, and everything worked just fine. I work with UTF-8 files, so the CP 65001 has been essential to me. My locale is plain old en-US, English language Windows 10 x64 Pro, and the OEM CP is the default 437.
- Set the following registry keys (save as .reg and import). For some reason, it i important to change FontFamily, as the default may be different, and the font won't be applied.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console]
"FaceName"="Consolas"
"FontFamily"=dword:00000036
"FontSize"=dword:000f0000
"FontWeight"=dword:00000190
"CodePage"=dword:0000fde9
-
Win+R
cmd.exe
ENTER. Console starts with the correct font and code page. Typechcp
; it prints 65001 (if does not, runchcp 65001
). - in the console, type
powershell -noprof
('-noprof' to confirm that the issue is not related to anything I load in my profile).
As PowerShell starts, the console font immediately changes to a raster font, and the window resizes to accommodate. The raster font selected is Terminal, and does not even even have WGL4 characters (no Cyrillic or Greek). So this is certainly a bug.
The behavior reproduces even if running a non-interactive command, so it's rather doubtful that the bug is related to PSReadLine:
powershell -noprof -nonint -command "echo foo"
Also, the console font changes similarly (essentially, the console opens in a raster font) if PowerShell is ran via a shortcut, or from the Win+R dialog, or by double-clicking in Explorer.
Also, some negatives. The font is not changed if either:
- I run
chcp 437
before invokingpowershell
from cmd. - The console font is set in the registry to "Lucida Console" (everything else stays same as above). That this font is somehow "special" has been already noted in the comments in this ticket.
The common theme in the comments in this issue has been, I believe, a non-US, European locale (German ans Spanish were mentioned). So i tried the following:
- Start cmd.exe
- Set console code page with
chcp NNN
(see below): - Run
powershell -noprof
.
- With NNN = 437, 1252, 1251, 1253, 850, 852, 869, 857, 737 - no font change
- With NNN = 65001, 858, and non-WGL4 Hebrew 862, Arabic 864 - font does change.
What sets the CP 858 apart? My guess is this may be the key. The CP name is "OEM Multilingual Latin 1 + Euro symbol".
Also notable is that chcp 1255
and chcp 1266
(Hebrew and Arabic) change font to "Courier New" even in cmd.exe. So PowerShell may be only somehow more susceptible, not the main culprit?
Obligatory version info:
C:\Users\kkm> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.17763.134
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.134
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Also, I should mention, although this is most likely irrelevant: I have a high-DPI display with the display scale set to 150%.
@kkm000 This was fixed in PSReadLine (https://github.com/lzybkr/PSReadLine/pull/771), but isn't in the build of Windows you are using, although the fix was checked into a newer build of Windows. I believe the newest public Beta of PSReadLine has the fix, so you can install it in Windows PowerShell using:
install-module psreadline -AllowPrerelease -Repository PSGallery -Force
# restart PowerShell to load the new one
If it complains that -AllowPrerelease
isn't found, you'll have to update PowerShellGet:
install-module powershellget -Scope CurrentUser -Repository psgallery -Force -AllowClobber
# restart PowerShell to load the new one
although the fix was checked into a newer build of Windows.
Does this mean that the fix will be coming to a future (19H1) Insiders release?
@50Wliu yes
@SteveL-MSFT i have the same version like @kkm000 , i ran you commands and not work for me, i miss something?