Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

aiorepl: Fix Enter key handling in raw terminal mode#1016

Open
andrewleech wants to merge 1 commit intomicropython:master from
andrewleech:fix-aiorepl-raw-terminal
Open

aiorepl: Fix Enter key handling in raw terminal mode #1016
andrewleech wants to merge 1 commit intomicropython:master from
andrewleech:fix-aiorepl-raw-terminal

Conversation

@andrewleech
Copy link
Contributor

@andrewleech andrewleech commented Jun 2, 2025

Summary

Fix aiorepl to properly handle the Enter key when stdin is in raw terminal mode by accepting both CR (0x0D) and LF (0x0A) for command execution.

Problem

When using aiorepl with MicroPython ports that put stdin in raw mode (such as the updated unix port using pyexec), the Enter key sends CR (0x0D) instead of LF (0x0A). The original aiorepl only handled LF, requiring users to use Ctrl+Enter instead of Enter to execute commands.

Solution

  • Handle both CR (0x0D) and LF (0x0A) for command execution
  • Improve handling of various newline sequences (CRLF, double-LF, double-CR) to prevent double-execution
  • Preserve original behavior in paste mode

Test plan

  • Verify Enter key now executes commands in raw terminal mode
  • Verify CRLF sequences don't cause double-execution
  • Verify paste mode still works correctly
  • Test with unix MicroPython port using new pyexec REPL

🤖 Generated with Claude Code

Handle both CR (0x0D) and LF (0x0A) for command execution to ensure
compatibility with raw terminal mode where Enter sends CR instead of LF.
This fixes the issue where aiorepl required Ctrl+Enter instead of
just Enter to execute commands when used with MicroPython ports that
put stdin in raw mode (such as the updated unix port using pyexec).
Also improves handling of various newline sequences (CRLF, double-LF,
double-CR) to prevent double-execution of commands.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Comments

AltStyle によって変換されたページ (->オリジナル) /