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

incorrect encoding in command mode #639

Closed
SolitaryN opened this issue Apr 10, 2023 · 26 comments · Fixed by TonyWu20/nvimdots#14
Closed

incorrect encoding in command mode #639

SolitaryN opened this issue Apr 10, 2023 · 26 comments · Fixed by TonyWu20/nvimdots#14
Labels
bug Something isn't working complexity:low Low-risk, unlikely to cause distant/indirect damage enhancement New feature or request platform:windows

Comments

@SolitaryN
Copy link

Feature description

like in normal mode to type:
:!gcc % && a.out

Additional information

No response

@SolitaryN SolitaryN added the enhancement New feature or request label Apr 10, 2023
@SolitaryN
Copy link
Author

I can run it in nvim, but i can't get the right react and answer of the command

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Apr 10, 2023

No idea what your desire result is. please be specific.

@CharlesChiuGit CharlesChiuGit removed the enhancement New feature or request label Apr 10, 2023
@Jint-lzxy Jint-lzxy added needs:response Waiting for reply from the author usage User-specific issues labels Apr 10, 2023
@ayamir
Copy link
Owner

ayamir commented Apr 10, 2023

Your command is incorrect. The correct way is !gcc % && ./a.out. BTW, I don't know this command whether works on windows.

@SolitaryN
Copy link
Author

Oops, that's my fault, i didn't not realize that it is Windows. And the correct command in Windows is :!gcc % && .\a.exe

@CharlesChiuGit
Copy link
Collaborator

@SolitaryN so is the problem solved?

@SolitaryN
Copy link
Author

But there are still some problem in the text format generated by the command in Windows. like below:
image

the command output format in nvim is not right.

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Apr 12, 2023

can confirmed. it happens in other places too, for example, plugin installation failed, but i'm not sure how to fix it. it seems like an encoding issue.

@CharlesChiuGit CharlesChiuGit added platform:windows enhancement New feature or request and removed needs:response Waiting for reply from the author labels Apr 12, 2023
@Jint-lzxy Jint-lzxy added bug Something isn't working needs:response Waiting for reply from the author and removed enhancement New feature or request usage User-specific issues labels Apr 12, 2023
@Jint-lzxy Jint-lzxy changed the title using the ! to run command in nvim incorrect encoding in command mode Apr 12, 2023
@Jint-lzxy
Copy link
Collaborator

Jint-lzxy commented Apr 12, 2023

We need some additional information (fill in all queries that are in bold [i.e., replace <your-response> with your answer] and tick all applicable checkboxes):

Raw markdown (please copy this)

- **Your $TERM environment variable:** _\<your-response\>_
- **Your operating system & version:** _\<your-response\>_
- [ ] My `nvim` supports multibyte text processing (`:echo has("multi_byte")` returns 1).
- [ ] This issue **can** be reproduced using other terminal emulators.
- [ ] The following command works as expected in PowerShell _(i.e., pwsh renders those texts and icons correctly. When applicable, icons are very close to the crosses but there is no overlap)_:
```pwsh
Write-Host ("E492:不是编辑器的命令", "", "", "", "XXXXXXXXX") -Separator " || "
```
- [ ] The above command works as expected in `nvim` (command mode).
- **The output of the following command in PowerShell is:** _\<your-response\>_
```pwsh
Write-Host ($OutputEncoding, [System.Console]::InputEncoding, [System.Console]::OutputEncoding) -Separator " | "
```
- **The output of the above command in `nvim` command mode is:** _\<your-response\>_
- **The output of the following commands in neovim:**
  - `:set encoding?`:  _\<your-response\>_
  - `:language`: _\<your-response\>_
  - `:set fileencodings?`: _\<your-response\>_

Preview:

  • Your $TERM environment variable: <your-response>
  • Your operating system & version: <your-response>
  • My nvim supports multibyte text processing (:echo has("multi_byte") returns 1).
  • This issue can be reproduced using other terminal emulators.
  • The following command works as expected in PowerShell (i.e., pwsh renders those texts and icons correctly. When applicable, icons are very close to the crosses but there is no overlap):
Write-Host ("E492:不是编辑器的命令", "", "", "", "XXXXXXXXX") -Separator " || "
  • The above command works as expected in nvim (command mode).
  • The output of the following command in PowerShell is: <your-response>
Write-Host ($OutputEncoding, [System.Console]::InputEncoding, [System.Console]::OutputEncoding) -Separator " | "
  • The output of the above command in nvim command mode is: <your-response>
  • The output of the following commands in neovim:
    • :set encoding?: <your-response>
    • :language: <your-response>
    • :set fileencodings?: <your-response>

cc @CharlesChiuGit @SolitaryN

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Apr 13, 2023

  • Your $TERM environment variable: xterm-256color compatible1 2
  • Your operating system & version: Win11 Pro. 22H2, 22621.1555
  • My nvim supports multibyte text processing (:echo has("multi_byte") returns 1).
  • This issue can be reproduced using other terminal emulators.

Half right, half wrong.

In wezterm on win11:
image

image

  • The following command works as expected in PowerShell (i.e., pwsh renders those texts and icons correctly. When applicable, icons are very close to the crosses but there is no overlap):
Write-Host ("E492:不是编辑器的命令", "", "", "", "XXXXXXXXX") -Separator " || "

They overlap.

Result: image

  • The above command works as expected in nvim (command mode).

it doesn't.

Result:
image

  • The output of the following command in PowerShell is:
Write-Host ($OutputEncoding, [System.Console]::InputEncoding, [System.Console]::OutputEncoding) -Separator " | "

Result: (same in wezterm's pwsh)
image

  • The output of the above command in nvim command mode is:

Result: (same in wezterm's pwsh)
image

  • The output of the following commands in neovim:
    • :set encoding?: utf-8
    • :language: LC_COLLATE=zh_TW;LC_CTYPE=zh_TW;LC_MONETARY=zh_TW;LC_NUMERIC=C;LC_TIME=zh_TW
    • :set fileencodings?: ucs-bom,utf-8,default,latin1

Footnotes

  1. https://superuser.com/questions/1691010/term-value-for-windows-10-terminal

  2. https://github.com/microsoft/terminal/issues/6045

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Apr 13, 2023

My screenshots with black background are in wezterm, and those with purple background are in windows terminal.

@CharlesChiuGit
Copy link
Collaborator

@SolitaryN can u try this draft? #659

I would like to know if this draft can get the same result on your machine as mine.

@SolitaryN
Copy link
Author

  • Your $TERM environment variable: nothing was printed(echo $TERM)

  • Your operating system & version: Windows10 22H2 19045.2604

  • [ x] My nvim supports multibyte text processing (:echo has("multi_byte") returns 1).

  • [x ] This issue can be reproduced using other terminal emulators.

  • The following command works as expected in PowerShell (i.e., pwsh renders those texts and icons correctly. When applicable, icons are very close to the crosses but there is no overlap):
    image

  • The above command works as expected in nvim (command mode).
    image

  • The output of the following command in PowerShell is: _
    image
    _

Write-Host ($OutputEncoding, [System.Console]::InputEncoding, [System.Console]::OutputEncoding) -Separator " | "
  • The output of the above command in nvim command mode is: image
  • The output of the following commands in neovim:
    • :set encoding?: encoding=utf-8
    • :language: image
    • :set fileencodings?: fileencodings=ucs-bom, utf-8,default,latin1

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Apr 14, 2023

  • Your $TERM environment variable: nothing was printed(echo $TERM)

  • Your operating system & version: Windows10 22H2 19045.2604

  • [ x] My nvim supports multibyte text processing (:echo has("multi_byte") returns 1).

  • [x ] This issue can be reproduced using other terminal emulators.

  • The following command works as expected in PowerShell (i.e., pwsh renders those texts and icons correctly. When applicable, icons are very close to the crosses but there is no overlap):

image

  • The above command works as expected in nvim (command mode).

image

  • The output of the following command in PowerShell is: _

image

_

Write-Host ($OutputEncoding, [System.Console]::InputEncoding, [System.Console]::OutputEncoding) -Separator " | "
  • The output of the above command in nvim command mode is: image

  • The output of the following commands in neovim:

    • :set encoding?: encoding=utf-8

    • :language: image

    • :set fileencodings?: fileencodings=ucs-bom, utf-8,default,latin1

I think u didn't install any nerdfont?

@SolitaryN
Copy link
Author

image
I installed cascadia-code, it is nerd-font right?

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Apr 14, 2023

image

I installed cascadia-code, it is nerd-font right?

it seems like u install it via scoop? i found the scoop version somehow looks different then directly downloaded and install the font from the official repo. can u try reinstall the nerdfont with this manner?( i'm using jetbtainsmono, maybe u can try it, i'm not sure if this make any difference.

also, did u set the font in windows terminal's shell profile?

@SolitaryN
Copy link
Author

image
yes, i installed it via scoop and I set the font in windows terminal profile.

@CharlesChiuGit
Copy link
Collaborator

could u try install jetbrainsmono from the official nerdfont repo? tks!

@SolitaryN
Copy link
Author

image
there are still wrong format in nvim
image

@SolitaryN
Copy link
Author

whether have you had this wrong in your nvim on Windows?

image there are still wrong format in nvim image

@CharlesChiuGit
Copy link
Collaborator

i think u use the wrong name, check "font settings" to get the correct name.

@CharlesChiuGit
Copy link
Collaborator

whether have you had this wrong in your nvim on Windows?

image there are still wrong format in nvim image

check my above comment

@CharlesChiuGit
Copy link
Collaborator

@SolitaryN can u try this draft? #659

I would like to know if this draft can get the same result on your machine as mine.

this one

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Apr 14, 2023

@SolitaryN so does the draft work?

@SolitaryN
Copy link
Author

Actually not, I mean maybe it's not suitable to use it in Windows, I will try it in WSL2.

@SolitaryN
Copy link
Author

thanks for your help and お世話になってすみませんでした、ありがとう

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Apr 15, 2023

@SolitaryN I think u will be interested in #659 (comment).

@Jint-lzxy Jint-lzxy added enhancement New feature or request complexity:low Low-risk, unlikely to cause distant/indirect damage and removed needs:response Waiting for reply from the author labels Apr 17, 2023
CharlesChiuGit added a commit that referenced this issue Apr 23, 2023
Co-authored-by: 冷酔閑吟 <50296129+Jint-lzxy@users.noreply.github.com>
Jint-lzxy added a commit that referenced this issue 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 issue 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 issue 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working complexity:low Low-risk, unlikely to cause distant/indirect damage enhancement New feature or request platform:windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants