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

A bug in Powershell using the tab key #997

Open
3 of 11 tasks
Shadow-XT opened this issue Mar 4, 2024 · 4 comments
Open
3 of 11 tasks

A bug in Powershell using the tab key #997

Shadow-XT opened this issue Mar 4, 2024 · 4 comments
Labels

Comments

@Shadow-XT
Copy link

Shadow-XT commented Mar 4, 2024

Current Behavior

PowerShell: 7.4.1
Windows: 22631.3235
When entering a command in PowerShell, such as git or gh, an error such as "^ [[21; 22; 23; 24; 25; 29m ^ [[3" will appear after pressing the tab key, which will affect normal use, as shown in the figure below:
image

Expected Behavior

If it is used normally, the following content should appear, and the excess "^ [[21; 22; 23; 24; 25; 29m ^ [[3" should not appear.
image

Steps To Reproduce

No response

Version

0.30.2

OS

  • Linux
  • OSX
  • Windows

Shell

  • Bash
  • Elvish
  • Fish
  • Nushell
  • Oil
  • Powershell
  • Xonsh
  • Zsh

Anything else?

No response

@Shadow-XT Shadow-XT added the bug Something isn't working label Mar 4, 2024
@rsteube rsteube added the windows label Mar 4, 2024
@rsteube
Copy link
Member

rsteube commented Mar 4, 2024

Ok this will be hard because it works for me.
The escape code should be one for the colored highlighting.

Is it only happening in gh <TAB> or somewhere else as well?
Might be related to some alias or extension (name/description).

@Shadow-XT
Copy link
Author

Shadow-XT commented Mar 5, 2024

Ok this will be hard because it works for me. The escape code should be one for the colored highlighting.

Is it only happening in gh <TAB> or somewhere else as well? Might be related to some alias or extension (name/description).

It also appears when using other commands, such as python, pip, etc., but with your reminder, I tried to modify my PowerShell Profile and found that the location of the loading configuration has a certain impact on whether the above bug will appear, as follows

#--------- configuration 1 ---------- 
Set-PSReadlineOption -EditMode Emacs
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
#---------------------------
#--------- configuration 2 ---------- 
#powershell (~/.config/powershell/Microsoft PowerShell_profile ps1)
Set-PSReadLineOption -Colors @{"Selection" = "'e [7m"}
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
Carapace _carapace | Out-String | Invoke-Expression
#---------------------------

It turns out that I put configuration 2 before configuration 1, and the above bug will appear. Now after reversing the order, the previous bug has not been found for the time being.

@rsteube
Copy link
Member

rsteube commented Mar 5, 2024

Seems to be related to the Emacs mode, i get the error on linux as well:

Set-PSReadlineOption -EditMode Emacs

Moving it above the other configuration fixes it indeed.

@Shadow-XT
Copy link
Author

Seems to be related to the Emacs mode, i get the error on linux as well:

Set-PSReadlineOption -EditMode Emacs

Moving it above the other configuration fixes it indeed.

It should be caused by this configuration. I tried to comment out the emacs mode, so the above problem will not occur. Thank you!

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

No branches or pull requests

2 participants