Skip to content

Conversation

@emmettlu
Copy link

Related Issue

#499

Copilot AI review requested due to automatic review settings December 18, 2025 08:39
Copy link
Contributor

Copilot AI left a 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.

Comment on lines 55 to 76
_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


Copy link

Copilot AI Dec 18, 2025

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.

Suggested change
_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 = "💫"

Copilot uses AI. Check for mistakes.
Copy link
Author

@emmettlu emmettlu Dec 18, 2025

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

@emmettlu emmettlu changed the title Replace Unicode symbols with ASCII on Windows for better compability fix: Replace Unicode symbols with ASCII on Windows for better compability Dec 18, 2025
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.

1 participant