Skip to content
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

fix(font-encoding): fix invalid characters on windows, fix #639 #659

Merged
merged 9 commits into from
Apr 23, 2023

Conversation

CharlesChiuGit
Copy link
Collaborator

@CharlesChiuGit CharlesChiuGit commented Apr 14, 2023

  1. set default shell from cmd to powershell.1
  2. set fileendoing to use utf-8 only

All screenshots are taken in windows terminal

TODO:

  1. icon overlapping (if anyone have this issue, just try another nerdfont)
  2. icon won't show in toggleterm.nvim, it only works in the neovim built-in terminal.
    圖片

Results:
圖片
圖片

Footnotes

  1. pwsh would be better, but it's not installed on windows by default. Only cmd and powershell are.

@CharlesChiuGit
Copy link
Collaborator Author

for the icon overlapping issue could be fixed if use wezterm as a workaround. it seems like a long term issue in windows terminal.

@CharlesChiuGit
Copy link
Collaborator Author

CharlesChiuGit commented Apr 14, 2023

Wezterm results on windows:
Built-in terminal:
圖片

toggleterm:
圖片

So it seems the remain issues are all about windows terminal...

@CharlesChiuGit
Copy link
Collaborator Author

CharlesChiuGit commented Apr 14, 2023

Actually, It's a font issue. After trying other fonts from nerdfonts on windows terminal. There's no more icon overlapping!
圖片

But the icon still doesn't show in toggleterm in windows terminal...
圖片

I think it's better to use wezterm for the sake of our sanity.

@CharlesChiuGit CharlesChiuGit marked this pull request as ready for review April 14, 2023 06:16
@Jint-lzxy
Copy link
Collaborator

Jint-lzxy commented Apr 14, 2023

@CharlesChiuGit Sorry for the late reply. I just did some testings on my Windows 10 VM. The known issues are:

  • cmd.exe requires some tweaks to fully support UTF-16LE (by setting codepage to a more appropriate value [CCSID 850 by default], which might need further discussion).
  • The flags for launching pwsh should be further adjusted to support command mode IO. Not tested yet.
  • Looks like those incorrect behaviors are all related to the terminal invoking nvim. This is not related to the configuration of nvim itself (well, except for the options: 'shell*')
  • The "icon overlapping issue" should be related to using incorrect font variants. AFAIK some terminal emulators will automatically adjust this behavior, but most will not.

For the first three items, I'll propose a draft solution ASAP.

For the last item, manually installing all fonts ending in Mono Windows Compatible can address this problem on my VM (and on any terminal), probably b/c the mono variant of Nerd Fonts should be more suitable for supporting terminal icons (as its name "mono" suggests). e.g.:
font

Then use JetBrainsMono Nerd Font Mono as the font name. Not sure if this method can solve the problem on your end.

@Jint-lzxy Jint-lzxy marked this pull request as draft April 14, 2023 15:18
@CharlesChiuGit
Copy link
Collaborator Author

CharlesChiuGit commented Apr 15, 2023

  • cmd.exe requires some tweaks to fully support UTF-16LE (by setting codepage to a more appropriate value [CCSID 850 by default], which might need further discussion).

I think supporting cmd is unnecessary, since every Windows ships with windows powershell by default. We can just set it as default shell in the nvim config.

  • The flags for launching pwsh should be further adjusted to support command mode IO. Not tested yet.

Can u explain more on "command mode IO"? I not sure what do u mean. I can run most Windows command with :!.

  • Looks like those incorrect behaviors are all related to the terminal invoking nvim. This is not related to the configuration of nvim itself (well, except for the options: 'shell*')

Ys, I follow the step in :h shell-powershell to set those things when the the detected OS is Windows.

  • The "icon overlapping issue" should be related to using incorrect font variants. AFAIK some terminal emulators will automatically adjust this behavior, but most will not.

Ys, I also discovered that installing nerd-font via third-party package manager like scoop might cause issue as I mentioned in #639 (comment). (at least it looks different then downloading the ttf files directly from https://www.nerdfonts.com/)

For the last item, manually installing all fonts ending in Mono Windows Compatible can address this problem on my VM (and on any terminal), probably b/c the mono variant of Nerd Fonts should be more suitable for supporting terminal icons (as its name "mono" suggests). e.g.:

Ys, use the mono or the NFM variants did the same work on solving the icon overlapping issues. The result of mono variant is exactly the results in my above comment.
image

image

@Jint-lzxy
Copy link
Collaborator

Jint-lzxy commented Apr 15, 2023

I think supporting cmd is unnecessary, since every Windows ships with windows powershell by default. We can just set it as default shell in the nvim config.

IMO we could vim.notify those users who haven't installed PowerShell on their machine - to avoid some extremely rare situations (such as running nvim on Windows Vista or accidentally uninstalled windows powershell 🤣)

Can u explain more on "command mode IO"? I not sure what do u mean. I can run most Windows command with :!.

I mean we should further specify how PowerShell works - e.g., whether to start in non interactive-mode/read user-configuration/set useful environment variables, with the goal of simulating bash's -c flag.

Ys, I also discovered that installing nerd-font via third-party package manager like scoop might cause issue as I mentioned in #639 (comment). (at least it looks different then downloading the ttf files directly from https://www.nerdfonts.com/)

I just tested this and it seems feasible to install the mono variant directly:

scoop install JetBrainsMono-NF-Mono

btw, are the icons displaying in Windows Terminal (toggleterm) now? Looks like the byte string wasn't properly pasted to toggleterm. Try using pure ASCII:

Write-Host "`u{ebb1}"

@CharlesChiuGit
Copy link
Collaborator Author

CharlesChiuGit commented Apr 15, 2023

actually "pwsh" is not the same as "windows powershell" lol

pwsh is the cross-platform version.

@CharlesChiuGit
Copy link
Collaborator Author

scoop install JetBrainsMono-NF-Mono

interesting! didn't knw that lol

@CharlesChiuGit
Copy link
Collaborator Author

btw, are the icons displaying in Windows Terminal (toggleterm) now? Looks like the byte string wasn't properly pasted to toggleterm. Try using pure ASCII:

Write-Host "`u{ebb1}"

will try once i got home.

@CharlesChiuGit
Copy link
Collaborator Author

CharlesChiuGit commented Apr 16, 2023

I just tested this and it seems feasible to install the mono variant directly:

scoop install JetBrainsMono-NF-Mono

This works! Cool! It will install these two font family.
圖片

btw, are the icons displaying in Windows Terminal (toggleterm) now? Looks like the byte string wasn't properly pasted to toggleterm. Try using pure ASCII:

Write-Host "`u{ebb1}"
  • In windows terminal(pwsh):
    圖片

  • In wezterm(pwsh):
    圖片

  • In windows terminal(nvim built-in terminal, pwsh):
    圖片

  • In windows terminal(nvim toggleterm, pwsh):
    圖片

  • In wezterm(nvim built-in terminal, pwsh):
    圖片

  • In wezterm(nvim toggleterm, pwsh):
    圖片

IMO we could vim.notify those users who haven't installed PowerShell on their machine - to avoid some extremely rare situations (such as running nvim on Windows Vista or accidentally uninstalled windows powershell 🤣)

Agreed.

I mean we should further specify how PowerShell works - e.g., whether to start in non interactive-mode/read user-configuration/set useful environment variables, with the goal of simulating bash's -c flag.

Got it, but I'm not sure how to test it lol. We can discuses more later.

@Jint-lzxy
Copy link
Collaborator

This works! Cool! It will install these two font family.

Great! NL here probably stands for no ligature, AFAIU. IMO we can add this to the wiki.

Got it, but I'm not sure how to test it lol. We can discuses more later.

We're gonna need massive reference to about_PowerShell_exe and about_Pwsh 😄

@CharlesChiuGit
Copy link
Collaborator Author

  • In windows terminal(nvim built-in terminal, pwsh):

Updated. It seems fine using pure ASCII, no matter where u use it. But
Write-Host ("E492:不是编辑器的命令", "", "", "", "XXXXXXXXX") -Separator " || " is still not valid in windows terminal(nvim toggleterm, pwsh).

@Jint-lzxy
Copy link
Collaborator

But <...> is still not valid in windows terminal(nvim toggleterm, pwsh).

Hmm maybe this is because those multi-byte icons were not properly pasted to toggleterm. Is pasting (fa-lock) directly to the terminal supported? (i.e., is the icon displayed before execution?)

@Jint-lzxy
Copy link
Collaborator

@CharlesChiuGit The following are all possible flags that we could further discuss:

  • -NoLogo - Hides the copyright banner at startup.
  • -ExecutionPolicy - Sets the default execution policy for the current session.
    • I prefer RemoteSigned -Scope Process -Force for maximum security & portability.
  • -Command - Executes the specified commands (and any parameters) as though they were typed at the PowerShell command prompt, and then exits, unless the NoExit parameter is specified.
    • I prefer New-Object and full module name for the script block:
- -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues['Out-File:Encoding']='utf-8';
+ -Command $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
  • -NoProfile - Does not load the PowerShell profile.
  • -NonInteractive - This switch is used to create sessions that shouldn't require user input. This is useful for scripts that run in scheduled tasks or CI/CD pipelines. Any attempts to use interactive features, like Read-Host or confirmation prompts, result in statement terminating errors rather than hanging.
    • I'm prone to add this flag since :! (bang) and system() are not interactive in neovim on *nix like systems.

LEGEND:

  • - should be added, but details need further discussion;
  • - whether to add this option requires further discussion.

@Jint-lzxy
Copy link
Collaborator

8282c80 cc @CharlesChiuGit If you have time to review & discuss this!

@Jint-lzxy Jint-lzxy marked this pull request as ready for review April 22, 2023 03:59
@CharlesChiuGit
Copy link
Collaborator Author

CharlesChiuGit commented Apr 22, 2023

Damn! I totally forgot to test this. Will test soon!

lua/core/init.lua Outdated Show resolved Hide resolved
@CharlesChiuGit
Copy link
Collaborator Author

But <...> is still not valid in windows terminal(nvim toggleterm, pwsh).

Hmm maybe this is because those multi-byte icons were not properly pasted to toggleterm. Is pasting (fa-lock) directly to the terminal supported? (i.e., is the icon displayed before execution?)

This works!
圖片

@CharlesChiuGit
Copy link
Collaborator Author

CharlesChiuGit commented Apr 22, 2023

  • -NoLogo somehow doesn't seem to work, the copyright banner still appears.
  • -ExecutionPolicy RemoteSigned -Scope Process -Force seems problematic, nvim process got shut down immediately after I open toggleterm, -ExecutionPolicy RemoteSigned -Scope Process cause the toggleterm to shut down immediately, but user will still remain in nvim.
  • -Command LGTM, but I also doesn't really know the syntax. The original one is from the nvim help :h shell_powershell.
  • NoProfile: I don't feel like adding it, b/c ppl might define aliases in their profile. Loading profiles is more like using shell in *nix-like OS. Also this doesn't seem effective, nothing changed after I add this flag.
  • -NonInteractive LGTM

@CharlesChiuGit
Copy link
Collaborator Author

I also notice sth. I'm not sure why, but current settings seem to increase noticeable startup time comparing to my original draft.
Maybe some api is a bit slower, will check some doc to analyze.

@Jint-lzxy
Copy link
Collaborator

  • -NoLogo somehow doesn't seem to work, the copyright banner still appears.

It's actually working, notice that:

Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

have disappeared.

  • -ExecutionPolicy RemoteSigned -Scope Process -Force seems problematic, nvim process got shut down immediately after I open toggleterm, -ExecutionPolicy RemoteSigned -Scope Process cause the toggleterm to shut down immediately, but user will still remain in nvim.

Oh yes, I forgot toggleterm will also use these options. "nvim process got shut down immediately" is b/c, from the documentation:

Executes the specified commands (and any parameters) as though they were typed at the PowerShell command prompt, and then exits, unless the -NoExit parameter is specified.

We probably need to add -NoExit, but I'm not sure if the emulator will work properly in :! (shell bang).

  • NoProfile: I don't feel like adding it, b/c ppl might define aliases in their profile. Loading profiles is more like using shell in *nix-like OS.

Sounds very reasonable 😄 Will remove this flag.

Also this doesn't seem effective, nothing changed after I add this flag.

Maybe u are missing something from about_Profiles?

but current settings seem to increase noticeable startup time comparing to my original draft.

Hmm that's strange... The current settings work fine with PowerShell core on macOS, will test this issue on Windows later ;)

@Jint-lzxy
Copy link
Collaborator

e5485ee

@CharlesChiuGit
Copy link
Collaborator Author

CharlesChiuGit commented Apr 23, 2023

圖片

From pwsh -h, and about Scopes, I think we can't set -Scope as a flag to pwsh. -Scope seems to only used for limiting the scopes when using Get-Variable, not for limiting current pwsh process.


-NoExit will somehow output an extra line of weird raw utf8 code straing in :!.

w/ -NoExit:
圖片

w/o -NoExit:
圖片


I think I found why toggleterm will still output profile loading time and copyright, that's b/c we need to append the flags after vim.o.shell like so:

		shell = string.format(
			"%s %s;",
			vim.o.shell,
			"-NoLogo -NoLogo -NoProfileLoadTime -NonInteractive -ExecutionPolicy RemoteSigned"
		), -- change the default shell

However, flags after -Command seems not been taken and it caused errors. Still need to research on that more.

圖片

圖片


The extra delay startup time seems to related to waiting for lsp to start, not directly related to the PR.

@CharlesChiuGit
Copy link
Collaborator Author

CharlesChiuGit commented Apr 23, 2023

After hours of debugging and reading the docs, I just don't think manual-inputed icons can be display correctly on toggleterm on windows terminal.

But everything just works fine in wezterm. So I think it's a native flaw on windows terminal.

I think we need to cut the losses, we had already invested too much time in this trial font issue.

@Jint-lzxy
Copy link
Collaborator

-NoExit will somehow output an extra line of weird raw utf8 code straing in :!.

This is exactly what I was concerned about before:

We probably need to add -NoExit, but I'm not sure if the emulator will work properly in :! (shell bang).

That "extra line" containing ANSI escape sequences is actually the user's PowerShell custom prompt. If -NoExit is not supplied PowerShell would exit right after the execution of :! with no trailing user prompt. Not sure if toggleterm will work properly if we ignore -NoExit.

Also, we should consider users who use powershell.exe, AFAIK powershell.exe provides fewer options than pwsh.exe. A proposed workaround:

local basecmd = "-NoLogo -MTA -ExecutionPolicy RemoteSigned"
local ctrlcmd = "-Command [console]::InputEncoding = [console]::OutputEncoding = [System.Text.Encoding]::UTF8"

The following configuration will handle the issue of toggleterm shutting down immediately right after the execution of -Command (tested on macOS, not sure if we also need to make this change on Windows):

vim.api.nvim_set_option_value("shellredir", '-RedirectStandardOutput %s -NoNewWindow -Wait', {})
vim.api.nvim_set_option_value("shellpipe", '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode', {})

I think we need to cut the lost, we had already invested too much time in this trial font issue.

💯💯 agreed. If the above proposal works properly, we should just merge this PR. As for the actual behavior of toggleterm (such as whether to ignore copyright information or not), users can customize this by setting shell = <...> in toggleterm.setup(). And since the :term feature of nvim was originally proposed to simulate system terminals, IMO displaying all these information happens to be the way native terminals work, out-of-the-box, so there is no need to make any changes to the appearance of the terminal buffer(s) 😃 The same applies to localized strings.

@CharlesChiuGit
Copy link
Collaborator Author

Not sure if toggleterm will work properly if we ignore -NoExit.

Ys, toggleterm would work without -NoExit.

Also, we should consider users who use powershell.exe,

That's reasonable. Agreed.

As for the actual behavior of toggleterm (such as whether to ignore copyright information or not), users can customize this by setting shell = <...> in toggleterm.setup().

Agreed.


local basecmd = "-NoLogo -MTA -ExecutionPolicy RemoteSigned"
local ctrlcmd = "-Command [console]::InputEncoding = [console]::OutputEncoding = [System.Text.Encoding]::UTF8"
    
vim.api.nvim_set_option_value("shellredir", '-RedirectStandardOutput %s -NoNewWindow -Wait', {})
vim.api.nvim_set_option_value("shellpipe", '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode', {})
    

Both of those new settings works fine on my win11.

@CharlesChiuGit CharlesChiuGit merged commit e2cfef9 into 0.9 Apr 23, 2023
@CharlesChiuGit CharlesChiuGit deleted the fix/win-encoding branch April 23, 2023 15:04
@Jint-lzxy
Copy link
Collaborator

A minor patch for consistent code style: f2f3c2c.

@CharlesChiuGit
Copy link
Collaborator Author

I just observe some interesting things.

Even in wezterm, sth the icons won't show up too!

wezterm, toggleterm:
圖片

This often happens when I just opened wezterm, as if wezterm itself haven't been "warm up".

If I open a second wezterm tab, everything just work again.
圖片

Such a mystery...

Jint-lzxy added a commit that referenced this pull request Apr 30, 2023
* chore(README): bump supported version

* feat(options): support new options shipped with v0.9

* feat(scripts): support v0.9

* feat!: add initial support for lsp semantic tokens (#633)

* feat(utils): use neovim builtin to get highlights (#632)

* fix: remove deprecated options for nvim-tree.

* fix(cmp): support dynamic `kind_text` from cmp source: `treesitter`, fix #624 #634 (#637)

* fix&feat: introduce suda.vim to write file with sudo

* chore(kind_text): cleanup (#648)

* feat(alpha): add custom highlight groups (#650)

* fix: install `psutils` by default for Windows users

* revert: bind `SudaWrite` to `<A-s>`

ref: #641 (comment)

* fix(cmp): nil `vim_item`

* perf(core-mapping): add some useful mapping

* fix(nvim-tree): `hide_root_folder` is deprecated

* perf: load fidget.nvim after `LspAttach`

* minor fix

1. remove `<nop>` at "n|Q"
2. use visual mode instead of visual-line mode for "n|<C-a>"

* perf: align style

* perf(0.9): `stabilize.nvim` had been upstream to `0.9`

* chore(project.nvim): update legacy code

* chore(README): update branch info

* chore(mapping): cleanup (#657)

* fix(icon): update invalid cmp icon (#665)

* chore/lspsaga_move (#667)

* fix: paint word boundary in python (#669)

* fix(bufferline): `show_buffer_default_icon` is now deprecate

* feat(formatting): notify users for files under disabled dirs

* chore(formatting): rephrase messages

* fix(font-encoding): fix invalid characters on windows, fix #639 (#659)

Co-authored-by: 冷酔閑吟 <50296129+Jint-lzxy@users.noreply.github.com>

* pref: unify code style for PowerShell commands

* perf: better guidance to `Discussions` and `Wiki` (#680)

* pref(ISSUE_TEMPLATE): fix typos and format with prettier

* fixup! pref(ISSUE_TEMPLATE): fix typos and format with prettier

* feat(scripts): abort for nvim v0.7 and its antecedent

* feat(settings): allow customization of `transparent_background` (#687)

* fix(bufferline): use defaults for `get_element_icon` (#685)

* feat(auto-session): remember opened buffers (#688)

* revert(keymap): remove redundant mappings.

* fix(catppuccin): properly detect `g:colors_name` (#695)

Ref: upstream breaking change [catppuccin/nvim@7a7a664]

---------

Co-authored-by: ayamir <lgt986452565@gmail.com>
Co-authored-by: Charles Chiu <charleschiu@hey.com>
Co-authored-by: CharlesChiuGit <charleschiu2012@gmail.com>
Co-authored-by: Xie Zejian <xiezej@gmail.com>
Co-authored-by: AngelontheRoad <52699138+AngelontheRoad@users.noreply.github.com>
Co-authored-by: Saafo <46736350+Saafo@users.noreply.github.com>
singlemancombat pushed a commit to singlemancombat/nvim-config that referenced this pull request May 1, 2023
* chore(README): bump supported version

* feat(options): support new options shipped with v0.9

* feat(scripts): support v0.9

* feat!: add initial support for lsp semantic tokens (ayamir#633)

* feat(utils): use neovim builtin to get highlights (ayamir#632)

* fix: remove deprecated options for nvim-tree.

* fix(cmp): support dynamic `kind_text` from cmp source: `treesitter`, fix ayamir#624 ayamir#634 (ayamir#637)

* fix&feat: introduce suda.vim to write file with sudo

* chore(kind_text): cleanup (ayamir#648)

* feat(alpha): add custom highlight groups (ayamir#650)

* fix: install `psutils` by default for Windows users

* revert: bind `SudaWrite` to `<A-s>`

ref: ayamir#641 (comment)

* fix(cmp): nil `vim_item`

* perf(core-mapping): add some useful mapping

* fix(nvim-tree): `hide_root_folder` is deprecated

* perf: load fidget.nvim after `LspAttach`

* minor fix

1. remove `<nop>` at "n|Q"
2. use visual mode instead of visual-line mode for "n|<C-a>"

* perf: align style

* perf(0.9): `stabilize.nvim` had been upstream to `0.9`

* chore(project.nvim): update legacy code

* chore(README): update branch info

* chore(mapping): cleanup (ayamir#657)

* fix(icon): update invalid cmp icon (ayamir#665)

* chore/lspsaga_move (ayamir#667)

* fix: paint word boundary in python (ayamir#669)

* fix(bufferline): `show_buffer_default_icon` is now deprecate

* feat(formatting): notify users for files under disabled dirs

* chore(formatting): rephrase messages

* fix(font-encoding): fix invalid characters on windows, fix ayamir#639 (ayamir#659)

Co-authored-by: 冷酔閑吟 <50296129+Jint-lzxy@users.noreply.github.com>

* pref: unify code style for PowerShell commands

* perf: better guidance to `Discussions` and `Wiki` (ayamir#680)

* pref(ISSUE_TEMPLATE): fix typos and format with prettier

* fixup! pref(ISSUE_TEMPLATE): fix typos and format with prettier

* feat(scripts): abort for nvim v0.7 and its antecedent

* feat(settings): allow customization of `transparent_background` (ayamir#687)

* fix(bufferline): use defaults for `get_element_icon` (ayamir#685)

* feat(auto-session): remember opened buffers (ayamir#688)

* revert(keymap): remove redundant mappings.

* fix(catppuccin): properly detect `g:colors_name` (ayamir#695)

Ref: upstream breaking change [catppuccin/nvim@7a7a664]

---------

Co-authored-by: ayamir <lgt986452565@gmail.com>
Co-authored-by: Charles Chiu <charleschiu@hey.com>
Co-authored-by: CharlesChiuGit <charleschiu2012@gmail.com>
Co-authored-by: Xie Zejian <xiezej@gmail.com>
Co-authored-by: AngelontheRoad <52699138+AngelontheRoad@users.noreply.github.com>
Co-authored-by: Saafo <46736350+Saafo@users.noreply.github.com>
boomker pushed a commit to boomker/uvcode-nvim that referenced this pull request May 2, 2023
* chore(README): bump supported version

* feat(options): support new options shipped with v0.9

* feat(scripts): support v0.9

* feat!: add initial support for lsp semantic tokens (ayamir#633)

* feat(utils): use neovim builtin to get highlights (ayamir#632)

* fix: remove deprecated options for nvim-tree.

* fix(cmp): support dynamic `kind_text` from cmp source: `treesitter`, fix ayamir#624 ayamir#634 (ayamir#637)

* fix&feat: introduce suda.vim to write file with sudo

* chore(kind_text): cleanup (ayamir#648)

* feat(alpha): add custom highlight groups (ayamir#650)

* fix: install `psutils` by default for Windows users

* revert: bind `SudaWrite` to `<A-s>`

ref: ayamir#641 (comment)

* fix(cmp): nil `vim_item`

* perf(core-mapping): add some useful mapping

* fix(nvim-tree): `hide_root_folder` is deprecated

* perf: load fidget.nvim after `LspAttach`

* minor fix

1. remove `<nop>` at "n|Q"
2. use visual mode instead of visual-line mode for "n|<C-a>"

* perf: align style

* perf(0.9): `stabilize.nvim` had been upstream to `0.9`

* chore(project.nvim): update legacy code

* chore(README): update branch info

* chore(mapping): cleanup (ayamir#657)

* fix(icon): update invalid cmp icon (ayamir#665)

* chore/lspsaga_move (ayamir#667)

* fix: paint word boundary in python (ayamir#669)

* fix(bufferline): `show_buffer_default_icon` is now deprecate

* feat(formatting): notify users for files under disabled dirs

* chore(formatting): rephrase messages

* fix(font-encoding): fix invalid characters on windows, fix ayamir#639 (ayamir#659)

Co-authored-by: 冷酔閑吟 <50296129+Jint-lzxy@users.noreply.github.com>

* pref: unify code style for PowerShell commands

* perf: better guidance to `Discussions` and `Wiki` (ayamir#680)

* pref(ISSUE_TEMPLATE): fix typos and format with prettier

* fixup! pref(ISSUE_TEMPLATE): fix typos and format with prettier

* feat(scripts): abort for nvim v0.7 and its antecedent

* feat(settings): allow customization of `transparent_background` (ayamir#687)

* fix(bufferline): use defaults for `get_element_icon` (ayamir#685)

* feat(auto-session): remember opened buffers (ayamir#688)

* revert(keymap): remove redundant mappings.

* fix(catppuccin): properly detect `g:colors_name` (ayamir#695)

Ref: upstream breaking change [catppuccin/nvim@7a7a664]

---------

Co-authored-by: ayamir <lgt986452565@gmail.com>
Co-authored-by: Charles Chiu <charleschiu@hey.com>
Co-authored-by: CharlesChiuGit <charleschiu2012@gmail.com>
Co-authored-by: Xie Zejian <xiezej@gmail.com>
Co-authored-by: AngelontheRoad <52699138+AngelontheRoad@users.noreply.github.com>
Co-authored-by: Saafo <46736350+Saafo@users.noreply.github.com>
(cherry picked from commit 08c4561)
@Jint-lzxy
Copy link
Collaborator

Jint-lzxy commented Jun 17, 2023

@CharlesChiuGit I just ran into a similar problem, and after some investigation, this also seems to be an encoding issue b/c:

  • Pasting a glyph directly worked (i.e., let the terminal convert the encoding if necessary);
  • Providing an Unicode code point explicitly (via `u{x}) worked (i.e., let the terminal handle the encoding details);
  • These characters were not replaced by the "replacement character" � (*nothing was translated), indicating that they are interpreted as something else, probably functional keys (like ins) that won't be fed to PowerShell.

Perhaps this is indeed related to the way WezTerm (or other similar emulators), PowerShell, and PSReadLine handle the input stack. The reason why everything works fine except for the glyphs provided by NF is probably that they all have fixed representation. E.g.:

Windows          終端機                    �  <- Glyph representing PowerShell
|Latin| |CJK Unified Ideograph|   |Private Use Area|

After WezTerm "warms up", all components should be configured as UTF-8 compatible, so everything will work normally from that time on.

@CharlesChiuGit
Copy link
Collaborator Author

Cool! Let's really interesting! Thanks for your observation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants