Mysterious `←[?1h` character appears when typing on Windows
edmundito opened this issue · comments
Describe the bug
The characters ←[?1h
appears whenever I type in my Windows terminal. It does not impact entering commands but it's annoying. This only started in recent weeks without many changes other than Windows update, OMZ updates.
Similarly described in zsh-users/zsh-autosuggestions#614 but I do not have the zsh-autosuggestions plugin installed (unless it's been integrated into omz directly?)
Steps to reproduce
- Setup git bash with zsh and omz
- Open git bash
- Type
Expected behavior
Nothing should appear
Screenshots and recordings
OS / Linux distribution
Windows 10
Zsh version
5.9
Terminal emulator
Windows Terminal, Cmd, Git Bash
If using WSL on Windows, which version of WSL
None
Additional context
No response
I have the same issue, it started just after updating omz. Running zsh -df
as suggested in the issue you linked does stop the ←[?1h
from appearing on my side. However, I doubt zsh-autosuggestions is the issue, since disabling it does not solve anything.
I only see the issue in the integrated terminal of PyCharm and VS Code, when launching Git Bash setup with ZSH and OMZ. Git Bash opened as standalone does not have the issue. Running Windows 11.
If you follow the steps mentioned here #12328 (comment), does it fix the issues for you?
If you follow the steps mentioned here #12328 (comment), does it fix the issues for you?
@carlosala It does not.
Running zsh -df as suggested in the issue you linked does stop the ←[?1h from appearing on my side. However, I doubt zsh-autosuggestions is the issue, since disabling it does not solve anything.
@Jouramie running zsh without the rcs is fine.
I found a workaround:
- Comment out
source ./...ohmzsh.sh
script in.zshrc
- Open new termina
- Remove the comment and re-run
source ./.zshrc
The prompt now works with omz correctly and does not show the issue. 🤔
You shouldn't source zshrc, in order to re-run a shell you can use exec zsh
or omz update
. @mcornella do you know why it could appear?
If this is fixed by loading OMZ last it must be that some bad setting is getting overriden. Perhaps it might be related to stty
settings backed up in check_for_upgrade.sh
1? Try disabling the auto update with
zstyle ':omz:update' mode disabled
to see if that bypasses the issue (which would confirm that 1 is related) and also please post your .zshrc
file that reproduces this.
@mcornella This did not make any difference.
Here's my .zshrc, nothing too interesting. I was trying to also disable the git autosuggest to see if that was the problem:
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="simple"
plugins=(git)
source $ZSH/oh-my-zsh.sh
unset ZSH_AUTOSUGGEST_USE_ASYNC
zstyle ':omz:alpha:lib:git' async-prompt no
zstyle ':omz:update' mode disabled
Hmm, I just found something that may have fixed the issue. I have an a lazy setup because I seldom use Windows and I'm running zsh through Git Bash and followed this setup: https://dominikrys.com/posts/zsh-in-git-bash-on-windows/
I just updated git for Windows and the problem is gone.
That makes it a not-our-issue
situation! Thanks for the debugging!
Thanks for posting the solution Edmundo!