Skip to content

Conversation

@majiayu000
Copy link

Summary

  • Add import readline to main.py for arrow key support in interactive mode
  • Wrap import in try/except for Windows compatibility
  • Add tests to verify readline import

Problem

In interactive mode, arrow keys produce escape sequences (^[[A, ^[[B, etc.) instead of navigating or browsing command history.

Solution

Import the readline module which provides proper terminal input handling. The import is wrapped in try/except since readline may not be available on Windows by default.

Fixes #223

Import readline module to enable proper arrow key navigation and command
history browsing in interactive mode. Without readline, arrow keys produce
escape sequences (^[[A, ^[[B, etc.) instead of expected behavior.

The import is wrapped in try/except for Windows compatibility where
readline may not be available by default.

Fixes zai-org#223
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