-
Notifications
You must be signed in to change notification settings - Fork 375
fix: Replace Unicode symbols with ASCII on Windows for better compability #500
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses issue #499 by replacing Unicode emoji symbols with ASCII characters in Windows terminals to fix display-width mismatches with prompt-toolkit that cause visual cursor alignment issues.
Key changes:
- Adds platform detection to conditionally use ASCII symbols on Windows (>,
$, ?) instead of Unicode emoji (✨, $ , 💫) - Preserves original Unicode symbols for non-Windows platforms
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| _prompt_symbol: str | ||
| _prompt_symbol_shell: str | ||
| _prompt_symbol_thinking: str | ||
|
|
||
|
|
||
| if sys.platform == "win32": | ||
| # On Windows terminals, emoji and some wide Unicode symbols can cause | ||
| # display-width mismatches with prompt-toolkit, leading to visual cursor | ||
| # shifts. Use plain ASCII / single-width symbols for better compatibility. | ||
| _prompt_symbol = ">" | ||
| _prompt_symbol_shell = "$" | ||
| _prompt_symbol_thinking = "?" | ||
| else: | ||
| _prompt_symbol = "✨" | ||
| _prompt_symbol_shell = "$" | ||
| _prompt_symbol_thinking = "💫" | ||
|
|
||
| PROMPT_SYMBOL = _prompt_symbol | ||
| PROMPT_SYMBOL_SHELL = _prompt_symbol_shell | ||
| PROMPT_SYMBOL_THINKING = _prompt_symbol_thinking | ||
|
|
||
|
|
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intermediate private variables (_prompt_symbol, _prompt_symbol_shell, _prompt_symbol_thinking) can be eliminated by directly assigning to the final constants within the if/else block. This would simplify the code and reduce the number of variables in the module namespace.
| _prompt_symbol: str | |
| _prompt_symbol_shell: str | |
| _prompt_symbol_thinking: str | |
| if sys.platform == "win32": | |
| # On Windows terminals, emoji and some wide Unicode symbols can cause | |
| # display-width mismatches with prompt-toolkit, leading to visual cursor | |
| # shifts. Use plain ASCII / single-width symbols for better compatibility. | |
| _prompt_symbol = ">" | |
| _prompt_symbol_shell = "$" | |
| _prompt_symbol_thinking = "?" | |
| else: | |
| _prompt_symbol = "✨" | |
| _prompt_symbol_shell = "$" | |
| _prompt_symbol_thinking = "💫" | |
| PROMPT_SYMBOL = _prompt_symbol | |
| PROMPT_SYMBOL_SHELL = _prompt_symbol_shell | |
| PROMPT_SYMBOL_THINKING = _prompt_symbol_thinking | |
| PROMPT_SYMBOL: str | |
| PROMPT_SYMBOL_SHELL: str | |
| PROMPT_SYMBOL_THINKING: str | |
| if sys.platform == "win32": | |
| # On Windows terminals, emoji and some wide Unicode symbols can cause | |
| # display-width mismatches with prompt-toolkit, leading to visual cursor | |
| # shifts. Use plain ASCII / single-width symbols for better compatibility. | |
| PROMPT_SYMBOL = ">" | |
| PROMPT_SYMBOL_SHELL = "$" | |
| PROMPT_SYMBOL_THINKING = "?" | |
| else: | |
| PROMPT_SYMBOL = "✨" | |
| PROMPT_SYMBOL_SHELL = "$" | |
| PROMPT_SYMBOL_THINKING = "💫" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it causes warns when using basedpyright as the language server
Related Issue
#499